import React from "react";
import { convertColorToTextClass } from "./colorUtils";
import {
Lightbulb,
Robot,
Aperture,
GraduationCap,
Jeep,
Island,
MathOperations,
Asclepius,
Couch,
Code,
Atom,
ClockCounterClockwise,
File,
Globe,
Palette,
Book,
Confetti,
House,
Translate,
Image,
BowlFood,
Lectern,
Wallet,
PencilLine,
Chalkboard,
} from "@phosphor-icons/react";
import { Markdown, OrgMode, Pdf, Word } from "@/app/components/logo/fileLogo";
interface IconMap {
[key: string]: (color: string, width: string, height: string) => JSX.Element | null;
}
const iconMap: IconMap = {
Lightbulb: (color: string, width: string, height: string) => (
),
Robot: (color: string, width: string, height: string) => (
),
Aperture: (color: string, width: string, height: string) => (
),
GraduationCap: (color: string, width: string, height: string) => (
),
Jeep: (color: string, width: string, height: string) => (
),
Island: (color: string, width: string, height: string) => (
),
MathOperations: (color: string, width: string, height: string) => (
),
Asclepius: (color: string, width: string, height: string) => (
),
Couch: (color: string, width: string, height: string) => (
),
Code: (color: string, width: string, height: string) => (
),
Atom: (color: string, width: string, height: string) => (
),
ClockCounterClockwise: (color: string, width: string, height: string) => (
),
Globe: (color: string, width: string, height: string) => (
),
Palette: (color: string, width: string, height: string) => (
),
Book: (color: string, width: string, height: string) => (
),
Confetti: (color: string, width: string, height: string) => (
),
House: (color: string, width: string, height: string) => (
),
Translate: (color: string, width: string, height: string) => (
),
BowlFood: (color: string, width: string, height: string) => (
),
Lectern: (color: string, width: string, height: string) => (
),
Wallet: (color: string, width: string, height: string) => (
),
PencilLine: (color: string, width: string, height: string) => (
),
Chalkboard: (color: string, width: string, height: string) => (
),
};
function getIconFromIconName(
iconName: string,
color: string = "gray",
width: string = "w-6",
height: string = "h-6",
) {
const icon = iconMap[iconName];
const colorName = color.toLowerCase();
const colorClass = convertColorToTextClass(colorName);
return icon ? icon(colorClass, width, height) : null;
}
function getIconFromFilename(
filename: string,
className: string = "w-6 h-6 text-muted-foreground inline-flex mr-1",
) {
const extension = filename.split(".").pop();
switch (extension) {
case "org":
return ;
case "markdown":
case "md":
return ;
case "pdf":
return ;
case "doc":
return ;
case "jpg":
case "jpeg":
case "png":
return ;
default:
return ;
}
}
export { getIconFromIconName, getIconFromFilename };