-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathGuideAnnotatedStatusDot.tsx
More file actions
77 lines (73 loc) · 1.69 KB
/
GuideAnnotatedStatusDot.tsx
File metadata and controls
77 lines (73 loc) · 1.69 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
74
75
76
77
import { Stack } from "@telegraph/layout";
import { Tooltip } from "@telegraph/tooltip";
import { sharedTooltipProps } from "./helpers";
export type StatusColor = "blue" | "red" | "yellow" | "gray";
// Directly copied from the design prototype.
const STATUS_SHAPES: Record<StatusColor, React.ReactNode> = {
blue: (
<svg width="8" height="8" viewBox="0 0 8 8" aria-hidden>
<circle cx="4" cy="4" r="4" fill="var(--tgph-blue-9)" />
</svg>
),
yellow: (
<svg width="8" height="8" viewBox="0 0 8 8" aria-hidden>
<polygon points="4,0.5 7.5,7.5 0.5,7.5" fill="var(--tgph-yellow-9)" />
</svg>
),
gray: (
<svg width="8" height="8" viewBox="0 0 8 8" aria-hidden>
<circle
cx="4"
cy="4"
r="2.75"
fill="none"
stroke="var(--tgph-gray-9)"
strokeWidth="2.5"
/>
</svg>
),
red: (
<svg width="8" height="8" viewBox="0 0 8 8" aria-hidden>
<line
x1="1.5"
y1="1.5"
x2="6.5"
y2="6.5"
stroke="var(--tgph-red-9)"
strokeWidth="2"
strokeLinecap="round"
/>
<line
x1="6.5"
y1="1.5"
x2="1.5"
y2="6.5"
stroke="var(--tgph-red-9)"
strokeWidth="2"
strokeLinecap="round"
/>
</svg>
),
};
export const GuideAnnotatedStatusDot = ({
color,
tooltip,
}: {
color: StatusColor;
tooltip: string;
}) => {
return (
<Tooltip label={tooltip} {...sharedTooltipProps}>
<Stack
as="span"
align="center"
justify="center"
display="inline-flex"
p="0_5"
style={{ flexShrink: 0 }}
>
{STATUS_SHAPES[color]}
</Stack>
</Tooltip>
);
};