Skip to content

Commit fe8e148

Browse files
committed
fix: added support for condition color/showing as well
1 parent 9e319e5 commit fe8e148

13 files changed

Lines changed: 13920 additions & 218 deletions

package-lock.json

Lines changed: 13455 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-odontogram",
33
"description": "dental chart for selecting teeth",
4-
"version": "0.4.9",
4+
"version": "0.5.0",
55
"author": "Pratik Sharma <sharma.pratik2016@gmail.com>",
66
"license": "MIT",
77
"keywords": [
@@ -30,7 +30,7 @@
3030
"link:self": "pnpm link --global",
3131
"prepare": "lefthook install",
3232
"deploy-storybook": "gh-pages -d storybook-static",
33-
"test:coverage": "vitest run --coverage"
33+
"coverage": "vitest run --coverage"
3434
},
3535
"types": "./dist/index.d.ts",
3636
"exports": {
@@ -118,4 +118,4 @@
118118
"lefthook"
119119
]
120120
}
121-
}
121+
}

src/Labels.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { FC } from "react";
2+
import type { ToothConditionGroup } from "./type";
3+
4+
type ConditionLabelsProps = {
5+
conditions?: ToothConditionGroup[];
6+
className?: string;
7+
};
8+
9+
export const ConditionLabels: FC<ConditionLabelsProps> = ({
10+
conditions,
11+
className = "",
12+
}) => {
13+
if (!conditions || conditions.length === 0) return null;
14+
15+
return (
16+
<div
17+
className={className}
18+
style={{
19+
display: "flex",
20+
gap: 8,
21+
fontFamily: "sans-serif",
22+
fontSize: 14,
23+
flexWrap: "wrap",
24+
}}
25+
role="list"
26+
aria-label="Tooth condition legend"
27+
>
28+
{conditions.map((condition) => (
29+
<div
30+
key={condition.label}
31+
role="listitem"
32+
style={{
33+
display: "flex",
34+
alignItems: "center",
35+
gap: 8,
36+
}}
37+
>
38+
<span
39+
aria-hidden="true"
40+
style={{
41+
width: 14,
42+
height: 14,
43+
borderRadius: 4,
44+
background: condition.fillColor,
45+
border: `2px solid ${condition.outlineColor ?? condition.fillColor
46+
}`,
47+
display: "inline-block",
48+
}}
49+
/>
50+
<span style={{ textTransform: "capitalize" }}>
51+
{condition.label}
52+
</span>
53+
</div>
54+
))}
55+
</div>
56+
);
57+
};
58+
59+
export default ConditionLabels;

0 commit comments

Comments
 (0)