diff --git a/src/utils/icons.ts b/src/utils/icons.ts index fdb1eea..2664d29 100644 --- a/src/utils/icons.ts +++ b/src/utils/icons.ts @@ -7,6 +7,8 @@ export const getIcon = (file: Child | string | undefined): Icon => { if (!file) return DEFAULT_ICON; if (typeof file === "string") { + if (ICONS[file]) return ICONS[file]; + const parts = file.split("."); const iconName = parts[parts.length - 1]; diff --git a/src/utils/tree.ts b/src/utils/tree.ts index d991806..bf80cbe 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -55,11 +55,11 @@ export const folder = (name: string, children: Array): Folder => ({ children, }); -export const link = (name: string, url: string, icon: Icon): Link => ({ +export const link = (name: string, url: string, icon: string): Link => ({ type: "link", name, url, - icon, + icon: getIcon(icon), }); export const file = (