mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 03:45:53 -05:00
15 lines
656 B
TypeScript
15 lines
656 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.replaceAll(/(?:^|-)([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;
|
|
}
|