-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathLabels.tsx
More file actions
59 lines (55 loc) · 1.73 KB
/
Labels.tsx
File metadata and controls
59 lines (55 loc) · 1.73 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
import { FC } from "react";
import type { ToothConditionGroup } from "./type";
type ConditionLabelsProps = {
conditions?: ToothConditionGroup[];
className?: string;
};
export const ConditionLabels: FC<ConditionLabelsProps> = ({
conditions,
className = "",
}) => {
if (!conditions || conditions.length === 0) return null;
return (
<div
className={className}
style={{
display: "flex",
gap: 8,
fontFamily: "sans-serif",
fontSize: 14,
flexWrap: "wrap",
}}
role="list"
aria-label="Tooth condition legend"
>
{conditions.map((condition) => (
<div
key={condition.label}
role="listitem"
style={{
display: "flex",
alignItems: "center",
gap: 8,
}}
>
<span
aria-hidden="true"
style={{
width: 14,
height: 14,
borderRadius: 4,
background: condition.fillColor,
border: `2px solid ${condition.outlineColor ?? condition.fillColor
}`,
display: "inline-block",
}}
/>
<span style={{ textTransform: "capitalize" }}>
{condition.label}
</span>
</div>
))}
</div>
);
};
export default ConditionLabels;