@@ -7,103 +7,103 @@ import type { Equals } from "tsafe";
77
88const { meta, getStory } = getStoryFactory < BadgeProps > ( {
99 sectionName,
10- wrappedComponent : { Badge } ,
10+ " wrappedComponent" : { Badge } ,
1111 description : `
1212- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/badge)
1313- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Badge.tsx)` ,
14- argTypes : {
15- severity : {
16- options : ( ( ) => {
17- const severities = [ "success" , "warning" , "info" , "error" , "new" ] as const ;
14+ " argTypes" : {
15+ " severity" : {
16+ " options" : ( ( ) => {
17+ const options = [ "success" , "warning" , "info" , "error" , "new" , undefined ] as const ;
1818
19- assert < Equals < typeof severities [ number ] , BadgeProps . Severity > > ( ) ;
19+ assert < Equals < typeof options [ number ] , BadgeProps [ "severity" ] > > ( ) ;
2020
21- return [ null , ... severities ] ;
21+ return options ;
2222 } ) ( ) ,
23- control : { type : "select" , labels : { null : "no severity" } }
23+ " control" : { type : "select" , labels : { null : "no severity" } }
2424 } ,
25- noIcon : {
26- type : { name : "boolean" } ,
27- description : "Remove badge icon when true"
25+ " noIcon" : {
26+ " type" : { " name" : "boolean" } ,
27+ " description" : "Remove badge icon when true"
2828 } ,
29- isSmall : {
30- type : { name : "boolean" } ,
31- description : "Set small badge size (`sm`) when true"
29+ "small" : {
30+ " type" : { " name" : "boolean" } ,
31+ " description" : "Set small badge size (`sm`) when true"
3232 } ,
33- label : {
34- type : { name : "string" , required : true } ,
35- description : "Label to display on the badge"
33+ " label" : {
34+ " type" : { " name" : "string" , " required" : true } ,
35+ " description" : "Label to display on the badge"
3636 }
3737 } ,
38- disabledProps : [ "lang" ]
38+ " disabledProps" : [ "lang" ]
3939} ) ;
4040
4141export default meta ;
4242
4343export const Default = getStory ( {
44- severity : "success" ,
45- label : "Label badge"
44+ " severity" : "success" ,
45+ " label" : "Label badge"
4646} ) ;
4747
4848export const BadgeWithoutSeverity = getStory (
4949 {
50- label : "Label"
50+ " label" : "Label"
5151 } ,
5252 {
53- description : "Medium info `Badge` with icon"
53+ " description" : "Medium info `Badge` with icon"
5454 }
5555) ;
5656
5757export const InfoBadge = getStory (
5858 {
59- severity : "info" ,
60- label : "Label info"
59+ " severity" : "info" ,
60+ " label" : "Label info"
6161 } ,
6262 {
63- description : "Medium info `Badge` with icon"
63+ " description" : "Medium info `Badge` with icon"
6464 }
6565) ;
6666
6767export const WarningBadge = getStory (
6868 {
69- severity : "warning" ,
70- noIcon : false ,
71- label : 'Label "warning"'
69+ " severity" : "warning" ,
70+ " noIcon" : false ,
71+ " label" : 'Label "warning"'
7272 } ,
7373 {
74- description : "Medium warning `Badge` with icon"
74+ " description" : "Medium warning `Badge` with icon"
7575 }
7676) ;
7777
7878export const SuccessBadge = getStory (
7979 {
80- severity : "success" ,
81- noIcon : true ,
82- label : "Label success"
80+ " severity" : "success" ,
81+ " noIcon" : true ,
82+ " label" : "Label success"
8383 } ,
8484 {
85- description : "Medium success `Badge` without icon"
85+ " description" : "Medium success `Badge` without icon"
8686 }
8787) ;
8888
8989export const ErrorBadge = getStory (
9090 {
91- severity : "error" ,
92- noIcon : true ,
93- label : "Label error"
91+ " severity" : "error" ,
92+ " noIcon" : true ,
93+ " label" : "Label error"
9494 } ,
9595 {
96- description : "Medium error `Badge` without icon"
96+ " description" : "Medium error `Badge` without icon"
9797 }
9898) ;
9999
100100export const NewBadge = getStory (
101101 {
102- severity : "new" ,
103- isSmall : true ,
104- label : "Label new"
102+ " severity" : "new" ,
103+ "small" : true ,
104+ " label" : "Label new"
105105 } ,
106106 {
107- description : "Small new `Badge` with icon"
107+ " description" : "Small new `Badge` with icon"
108108 }
109109) ;
0 commit comments