Repository navigation
Expand file tree
/
Copy pathEnvironmentMachineIcon.tsx
More file actions
73 lines (66 loc) · 1.87 KB
/
Copy pathEnvironmentMachineIcon.tsx
File metadata and controls
73 lines (66 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import type { EnvironmentMachineKind } from "@t3tools/contracts";
import { CloudIcon, LaptopIcon, MonitorIcon, ServerIcon, type LucideProps } from "lucide-react";
import type { FunctionComponent, SVGProps } from "react";
import { LinuxIcon } from "./Icons";
function LucideLike(props: SVGProps<SVGSVGElement>) {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="1.75"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
/>
);
}
function MacMiniIcon(props: SVGProps<SVGSVGElement>) {
return (
<LucideLike {...props}>
<rect width="18" height="12" x="3" y="6" rx="2.5" />
<circle cx="7.5" cy="12" r="1" fill="currentColor" stroke="none" />
</LucideLike>
);
}
function MacStudioIcon(props: SVGProps<SVGSVGElement>) {
return (
<LucideLike {...props}>
<rect width="18" height="14" x="3" y="5" rx="2" />
<path d="M7 15h.01M11 15h.01M15 15h.01" />
</LucideLike>
);
}
const ICON_BY_KIND: Record<EnvironmentMachineKind, FunctionComponent<LucideProps>> = {
server: ServerIcon,
cloud: CloudIcon,
linux: LinuxIcon,
desktop: MonitorIcon,
laptop: LaptopIcon,
"mac-mini": MacMiniIcon,
"mac-studio": MacStudioIcon,
};
export const ENVIRONMENT_MACHINE_KIND_LABELS: Record<EnvironmentMachineKind, string> = {
server: "Server",
cloud: "Cloud VM",
linux: "Linux/WSL",
desktop: "Desktop",
laptop: "Laptop",
"mac-mini": "Mini PC",
"mac-studio": "Workstation",
};
export function environmentMachineIcon(
kind: EnvironmentMachineKind,
): FunctionComponent<LucideProps> {
return ICON_BY_KIND[kind];
}
export function EnvironmentMachineIcon({
kind,
...props
}: LucideProps & { readonly kind: EnvironmentMachineKind }) {
const Icon = ICON_BY_KIND[kind];
return <Icon {...props} />;
}