Skip to content

Commit

Permalink
⚙️ Create getIcons utility + export Icons & FoldersIcons
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
pheralb committed Sep 8, 2024
1 parent a008ba6 commit 0ebf385
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions website/app/data/svgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ export interface iIcons {
icon: React.FC<React.SVGProps<SVGSVGElement>>;
}

export const Icons: iIcons[] = Object.keys(ReactSymbols)
.filter((key) => !key.startsWith("Folder"))
.map((key) => ({
name: key,
icon: (
ReactSymbols as Record<string, React.FC<React.SVGProps<SVGSVGElement>>>
)[key],
}));
const getIcons = (filterFn: (key: string) => boolean): iIcons[] => {
return Object.keys(ReactSymbols)
.filter(filterFn)
.map((key) => ({
name: key,
icon: (
ReactSymbols as Record<string, React.FC<React.SVGProps<SVGSVGElement>>>
)[key],
}));
};

export const FoldersIcons: iIcons[] = Object.keys(ReactSymbols)
.filter((key) => key.startsWith("Folder"))
.map((key) => ({
name: key,
icon: (
ReactSymbols as Record<string, React.FC<React.SVGProps<SVGSVGElement>>>
)[key],
}));
export const Icons: iIcons[] = getIcons((key) => !key.startsWith("Folder"));
export const FoldersIcons: iIcons[] = getIcons((key) =>
key.startsWith("Folder"),
);

export const totalLibraryIcons = [...Icons, ...FoldersIcons].length;
export const totalIcons = Icons.length;
export const totalFolders = FoldersIcons.length;

0 comments on commit 0ebf385

Please sign in to comment.