11import React from "react" ;
22import { Card , type CardProps } from "../dist/Card" ;
33import { Badge } from "../dist/Badge" ;
4+ import { Tag } from "../dist/Tag" ;
45import { sectionName } from "./sectionName" ;
56import { getStoryFactory } from "./getStory" ;
67import { assert } from "tsafe/assert" ;
@@ -33,19 +34,80 @@ const { meta, getStory } = getStoryFactory({
3334 } ,
3435 enlargeLink : {
3536 "description" : `Set to false to restrict the link area to the Card title only.` ,
37+ defaultValue : false ,
3638 "control" : { "type" : "boolean" }
3739 } ,
40+ iconId : {
41+ "options" : ( ( ) => {
42+ const options = [ "fr-icon-checkbox-circle-line" , "ri-ancient-gate-fill" ] as const ;
43+
44+ assert <
45+ typeof options [ number ] extends NonNullable < CardProps [ "iconId" ] > ? true : false
46+ > ( ) ;
47+
48+ return options ;
49+ } ) ( ) ,
50+ "control" : { "type" : "radio" }
51+ } ,
3852 size : {
3953 "description" : "Card title text sizing" ,
4054 "options" : ( ( ) => {
4155 const sizes = [ "small" , "medium" , "large" ] as const ;
4256 assert < Equals < typeof sizes [ number ] | undefined , CardProps [ "size" ] > > ( ) ;
4357 return sizes ;
4458 } ) ( ) ,
59+ defaultValue : "medium" ,
4560 "control" : { "type" : "radio" }
4661 } ,
4762 imageUrl : {
4863 "description" : "Use any image URL, or none"
64+ } ,
65+ imageAlt : {
66+ "description" : "Alternative text for the image"
67+ } ,
68+ badge : {
69+ description : "Badge in the header"
70+ } ,
71+ start : {
72+ description :
73+ "Zone containing either tags group or badges group (not both) located above the card title"
74+ } ,
75+ detail : {
76+ description : "Hint text about the `start` zone"
77+ } ,
78+ end : {
79+ description : "Extra details or actions below the card content"
80+ } ,
81+ endDetail : {
82+ description : "Hint text about the `end` zone"
83+ } ,
84+ footer : {
85+ description : "Footer"
86+ } ,
87+ horizontal : {
88+ description : "Horizontal alignment" ,
89+ defaultValue : false ,
90+ type : "boolean"
91+ } ,
92+ background : {
93+ description : "Card with opaque background" ,
94+ defaultValue : true ,
95+ type : "boolean"
96+ } ,
97+ border : {
98+ description : "Card with border" ,
99+ defaultValue : true ,
100+ type : "boolean"
101+ } ,
102+ shadow : {
103+ description : "Card with shadow" ,
104+ defaultValue : false ,
105+ type : "boolean"
106+ } ,
107+ grey : {
108+ description : "Card content zone with grey background" ,
109+ defaultValue : false ,
110+ type : "boolean"
49111 }
50112 } ,
51113 "disabledProps" : [ "lang" ]
@@ -101,12 +163,12 @@ export const CardWithImageRatio = getStory(
101163export const CardWithBadgeInTheHeader = getStory (
102164 {
103165 ...defaultProps ,
104- "badges " : [ < Badge > LABEL BADGE</ Badge > , < Badge severity = "new" > LABEL BADGE </ Badge > ]
166+ "badge " : < Badge > LABEL BADGE</ Badge >
105167 } ,
106- { "description" : "Carte verticale avec badge dans l'image" }
168+ { "description" : "Carte verticale avec un badge dans l'image" }
107169) ;
108170
109- export const CardWithBadgeInTheContent = getStory (
171+ export const CardWithBadgesInTheContent = getStory (
110172 {
111173 ...defaultProps ,
112174 "start" : (
@@ -120,13 +182,54 @@ export const CardWithBadgeInTheContent = getStory(
120182 </ ul >
121183 )
122184 } ,
123- { "description" : "Carte verticale avec badges dans le contenu" }
185+ { "description" : "Carte verticale avec plusieurs badges dans le contenu" }
186+ ) ;
187+
188+ export const CardWithBadgeInTheHeaderAndTagsInTheContent = getStory (
189+ {
190+ ...defaultProps ,
191+ "badge" : < Badge severity = "new" > LABEL BADGE</ Badge > ,
192+ "start" : (
193+ < ul className = { fr . cx ( "fr-tags-group" ) } >
194+ < li >
195+ < Tag > LABEL TAG 1</ Tag >
196+ </ li >
197+ < li >
198+ < Tag > LABEL TAG 2</ Tag >
199+ </ li >
200+ </ ul >
201+ )
202+ } ,
203+ {
204+ "description" :
205+ "Carte verticale avec un badge dans l'image et plusieurs tags dans le contenu"
206+ }
207+ ) ;
208+
209+ export const CardWithTagsInTheContent = getStory (
210+ {
211+ ...defaultProps ,
212+ "start" : (
213+ < ul className = { fr . cx ( "fr-tags-group" ) } >
214+ < li >
215+ < Tag > LABEL TAG 1</ Tag >
216+ </ li >
217+ < li >
218+ < Tag > LABEL TAG 2</ Tag >
219+ </ li >
220+ </ ul >
221+ )
222+ } ,
223+ { "description" : "Carte verticale avec plusieurs tags dans le contenu" }
124224) ;
125225
126226export const CardWithDetail = getStory (
127227 {
128228 ...defaultProps ,
129- "detail" : "détail(optionnel)"
229+ "detail" : "détail(optionnel)" ,
230+ "classes" : {
231+ detail : fr . cx ( "fr-icon-warning-fill" )
232+ }
130233 } ,
131234 { "description" : "Carte verticale avec détail" }
132235) ;
@@ -262,14 +365,14 @@ export const CardHorizontalWithActions = getStory(
262365 "enlargeLink" : false ,
263366 "horizontal" : true ,
264367 "size" : "large" ,
265- "badges " : [ < Badge > LABEL BADGE</ Badge > ] ,
368+ "badge " : < Badge > LABEL BADGE</ Badge > ,
266369 "start" : (
267- < ul className = { fr . cx ( "fr-badges -group" ) } >
370+ < ul className = { fr . cx ( "fr-tags -group" ) } >
268371 < li >
269- < Badge > LABEL BADGE </ Badge >
372+ < Tag > LABEL TAG 1 </ Tag >
270373 </ li >
271374 < li >
272- < Badge severity = "new" > LABEL BADGE </ Badge >
375+ < Tag > LABEL TAG 2 </ Tag >
273376 </ li >
274377 </ ul >
275378 ) ,
0 commit comments