blob: c56a69e74bdcaa8d54d9eed9eaf373476d5f4de7 [file] [log] [blame]
gio5f2f1002025-03-20 18:38:48 +04001import { NodeType } from "@/lib/state";
gioa2a845c2025-05-08 11:27:14 +00002import { ReactElement } from "react";
3import { SiGithub, SiMongodb, SiPostgresql } from "react-icons/si";
4import { GrServices } from "react-icons/gr";
5import { GoFileDirectoryFill } from "react-icons/go";
6import { TbWorldWww } from "react-icons/tb";
7import { PiNetwork } from "react-icons/pi";
8import { AiOutlineGlobal } from "react-icons/ai";
gio5f2f1002025-03-20 18:38:48 +04009
gio0b4002c2025-05-11 15:48:51 +000010type Props = {
11 type: NodeType | undefined;
12 className?: string;
13};
14
15export function Icon({ type, className }: Props): ReactElement {
giod0026612025-05-08 13:00:36 +000016 switch (type) {
17 case "app":
gio0b4002c2025-05-11 15:48:51 +000018 return <GrServices className={className} />;
giod0026612025-05-08 13:00:36 +000019 case "github":
gio0b4002c2025-05-11 15:48:51 +000020 return <SiGithub className={className} />;
giod0026612025-05-08 13:00:36 +000021 case "gateway-https":
gio0b4002c2025-05-11 15:48:51 +000022 return <TbWorldWww className={className} />;
giod0026612025-05-08 13:00:36 +000023 case "gateway-tcp":
gio0b4002c2025-05-11 15:48:51 +000024 return <PiNetwork className={className} />;
giod0026612025-05-08 13:00:36 +000025 case "mongodb":
gio0b4002c2025-05-11 15:48:51 +000026 return <SiMongodb className={className} />;
giod0026612025-05-08 13:00:36 +000027 case "postgresql":
gio0b4002c2025-05-11 15:48:51 +000028 return <SiPostgresql className={className} />;
giod0026612025-05-08 13:00:36 +000029 case "volume":
gio0b4002c2025-05-11 15:48:51 +000030 return <GoFileDirectoryFill className={className} />;
giod0026612025-05-08 13:00:36 +000031 case "network":
gio0b4002c2025-05-11 15:48:51 +000032 return <AiOutlineGlobal className={className} />;
giod0026612025-05-08 13:00:36 +000033 default:
34 throw new Error(`MUST NOT REACH! ${type}`);
35 }
36}