Skip to content

Commit 64c35c0

Browse files
pgrandneddecrulle
andauthored
Add type array of string for name of PieChart (#377)
* Add type array of string for name of PieChart * fmt * correct type and stories --------- Co-authored-by: Dylan Decrulle <[email protected]>
1 parent d6707cb commit 64c35c0

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/Chart/PieChart.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import "@gouvfr/dsfr-chart/PieChart/pie-chart.common";
55
import "@gouvfr/dsfr-chart/PieChart/pie-chart.css";
66
import {
77
chartWrapper,
8-
ChartProps,
9-
IntrinsicGraphType,
10-
BaseChartProps,
11-
stringifyObjectValue
8+
type ChartProps,
9+
type IntrinsicGraphType,
10+
type BaseChartProps,
11+
stringifyObjectValue,
12+
type ChartColor
1213
} from "./chartWrapper";
1314

1415
declare global {
@@ -24,7 +25,9 @@ declare global {
2425

2526
export type PieChartBaseProps = {
2627
fill?: boolean;
27-
} & ChartProps;
28+
name?: string[];
29+
color: ChartColor[];
30+
} & Omit<ChartProps, "name" | "color">;
2831

2932
export type PieChartProps = PieChartBaseProps & BaseChartProps;
3033

stories/charts/PieChart.stories.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ You can find an example [here](https://github.com/codegouvfr/react-dsfr/blob/bc2
2222
"y": {
2323
"description": "Array of value for the y axis"
2424
},
25-
"name": { "description": "Array of name", control: "object" },
26-
"color": { "description": "Array of color", control: "object" },
25+
"name": { "description": "Array of name" },
26+
"color": { "description": "Array of color" },
2727
"fill": { control: "boolean" }
2828
},
2929
"disabledProps": ["lang"],
@@ -34,5 +34,7 @@ export default meta;
3434

3535
export const Default = getStory({
3636
x: [1, 2, 3],
37-
y: [10, 20, 30]
37+
y: [10, 20, 30],
38+
name: ["Serie 1", "Serie 2", "Serie 3"],
39+
color: ["blue-france", "green-bourgeon", "blue-ecume"]
3840
});

0 commit comments

Comments
 (0)