mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 19:36:02 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
15 lines
653 B
TypeScript
15 lines
653 B
TypeScript
import { icons, type LucideIcon } from 'lucide-react';
|
|
import names from '../../../../packages/sdk/icons.json';
|
|
|
|
// Import lazily only: this module pulls the whole lucide icon set into its chunk.
|
|
const catalog: Readonly<Record<string, LucideIcon | undefined>> = icons;
|
|
const known = new Set<string>(names);
|
|
const exportName = (name: string): string =>
|
|
name.replace(/(?:^|-)([a-z0-9])/g, (_match, letter: string) => letter.toUpperCase());
|
|
|
|
export const iconNames: readonly string[] = Object.freeze([...names]);
|
|
|
|
export function resolveIcon(name: string): LucideIcon | undefined {
|
|
return known.has(name) ? catalog[exportName(name)] : undefined;
|
|
}
|