| gio | 5f2f100 | 2025-03-20 18:38:48 +0400 | [diff] [blame] | 1 | import { NodeType } from "@/lib/state"; |
| gio | a2a845c | 2025-05-08 11:27:14 +0000 | [diff] [blame] | 2 | import { ReactElement } from "react"; |
| 3 | import { SiGithub, SiMongodb, SiPostgresql } from "react-icons/si"; |
| 4 | import { GrServices } from "react-icons/gr"; |
| 5 | import { GoFileDirectoryFill } from "react-icons/go"; |
| 6 | import { TbWorldWww } from "react-icons/tb"; |
| 7 | import { PiNetwork } from "react-icons/pi"; |
| 8 | import { AiOutlineGlobal } from "react-icons/ai"; |
| gio | 5f2f100 | 2025-03-20 18:38:48 +0400 | [diff] [blame] | 9 | |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 10 | type Props = { |
| 11 | type: NodeType | undefined; |
| 12 | className?: string; |
| 13 | }; |
| 14 | |
| 15 | export function Icon({ type, className }: Props): ReactElement { |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 16 | switch (type) { |
| 17 | case "app": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 18 | return <GrServices className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 19 | case "github": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 20 | return <SiGithub className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 21 | case "gateway-https": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 22 | return <TbWorldWww className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 23 | case "gateway-tcp": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 24 | return <PiNetwork className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 25 | case "mongodb": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 26 | return <SiMongodb className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 27 | case "postgresql": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 28 | return <SiPostgresql className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 29 | case "volume": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 30 | return <GoFileDirectoryFill className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 31 | case "network": |
| gio | 0b4002c | 2025-05-11 15:48:51 +0000 | [diff] [blame] | 32 | return <AiOutlineGlobal className={className} />; |
| gio | d002661 | 2025-05-08 13:00:36 +0000 | [diff] [blame] | 33 | default: |
| 34 | throw new Error(`MUST NOT REACH! ${type}`); |
| 35 | } |
| 36 | } |