|
1 | 1 | import React from "react"; |
2 | | -import { Card, CardProps } from "../dist/Card"; |
| 2 | +import { Card, type CardProps } from "../dist/Card"; |
3 | 3 | import { Badge } from "../dist/Badge"; |
4 | 4 | import { sectionName } from "./sectionName"; |
5 | 5 | import { getStoryFactory } from "./getStory"; |
@@ -47,211 +47,237 @@ const { meta, getStory } = getStoryFactory({ |
47 | 47 | export default meta; |
48 | 48 |
|
49 | 49 | const defaultProps = { |
50 | | - enlargeLink: true, |
51 | | - title: "Intitulé de la carte (sur lequel se trouve le lien)", |
52 | | - linkProps: { |
53 | | - href: "#" |
| 50 | + "enlargeLink": true as const, |
| 51 | + "title": "Intitulé de la carte (sur lequel se trouve le lien)", |
| 52 | + "linkProps": { |
| 53 | + "href": "#" |
54 | 54 | }, |
55 | | - desc: "Lorem ipsum dolor sit amet, consectetur adipiscing, incididunt, ut labore et dolore magna aliqua. Vitae sapien pellentesque habitant morbi tristique senectus et", |
56 | | - imageUrl: "https://www.systeme-de-design.gouv.fr/img/placeholder.16x9.png", |
57 | | - imageAlt: "texte alternatif de l’image" |
| 55 | + "desc": "Lorem ipsum dolor sit amet, consectetur adipiscing, incididunt, ut labore et dolore magna aliqua. Vitae sapien pellentesque habitant morbi tristique senectus et", |
| 56 | + "imageUrl": "https://www.systeme-de-design.gouv.fr/img/placeholder.16x9.png", |
| 57 | + "imageAlt": "texte alternatif de l’image" |
58 | 58 | }; |
59 | 59 |
|
60 | 60 | export const Default = getStory({ ...defaultProps }); |
61 | 61 |
|
62 | 62 | // todo: wrap with grid |
63 | 63 | export const CardWithoutEnlargeLink = getStory( |
64 | | - { ...defaultProps, enlargeLink: false }, |
65 | | - { description: "Carte sans lien étendu à la carte" } |
| 64 | + { ...defaultProps, "enlargeLink": false }, |
| 65 | + { "description": "Carte sans lien étendu à la carte" } |
66 | 66 | ); |
67 | 67 |
|
68 | 68 | export const CardWithIcon = getStory( |
69 | | - { ...defaultProps, iconId: "fr-icon-warning-fill" }, |
70 | | - { description: "Carte avec icône personnalisée" } |
| 69 | + { ...defaultProps, "iconId": "fr-icon-warning-fill" }, |
| 70 | + { "description": "Carte avec icône personnalisée" } |
71 | 71 | ); |
72 | 72 |
|
73 | 73 | export const CardWithoutBorder = getStory( |
74 | | - { ...defaultProps, border: false }, |
75 | | - { description: "Carte sans bordure" } |
| 74 | + { ...defaultProps, "border": false }, |
| 75 | + { "description": "Carte sans bordure" } |
76 | 76 | ); |
77 | 77 |
|
78 | 78 | export const CardWithShadow = getStory( |
79 | | - { ...defaultProps, shadow: true }, |
80 | | - { description: "Carte avec ombre portée" } |
| 79 | + { ...defaultProps, "shadow": true }, |
| 80 | + { "description": "Carte avec ombre portée" } |
81 | 81 | ); |
82 | 82 |
|
83 | 83 | export const CardWithoutImage = getStory( |
84 | | - { ...defaultProps, imageUrl: undefined }, |
85 | | - { description: "Carte sans image" } |
| 84 | + { ...defaultProps, "imageUrl": undefined }, |
| 85 | + { "description": "Carte sans image" } |
86 | 86 | ); |
87 | 87 |
|
88 | 88 | export const CardWithImageRatio = getStory( |
89 | | - { ...defaultProps, classes: { imgTag: "fr-ratio-3x4" } }, |
90 | | - { description: "Carte verticale avec image au ratio d'aspect 3x4" } |
| 89 | + { ...defaultProps, "classes": { "imgTag": "fr-ratio-3x4" } }, |
| 90 | + { "description": "Carte verticale avec image au ratio d'aspect 3x4" } |
91 | 91 | ); |
92 | 92 |
|
93 | 93 | export const CardWithBadgeInTheHeader = getStory( |
94 | 94 | { |
95 | 95 | ...defaultProps, |
96 | | - badges: [<Badge label="LABEL BADGE" />, <Badge label="LABEL BADGE" severity="new" />] |
| 96 | + "badges": [<Badge>LABEL BADGE</Badge>, <Badge severity="new">LABEL BADGE</Badge>] |
97 | 97 | }, |
98 | | - { description: "Carte verticale avec badge dans l'image" } |
| 98 | + { "description": "Carte verticale avec badge dans l'image" } |
99 | 99 | ); |
100 | 100 |
|
101 | 101 | export const CardWithBadgeInTheContent = getStory( |
102 | 102 | { |
103 | 103 | ...defaultProps, |
104 | | - detail: ( |
| 104 | + "detail": ( |
105 | 105 | <ul className={fr.cx("fr-badges-group")}> |
106 | | - <Badge label="LABEL BADGE" /> |
107 | | - <Badge label="LABEL BADGE" severity="new" /> |
| 106 | + <Badge>LABEL BADGE</Badge> |
| 107 | + <Badge severity="new">LABEL BADGE</Badge> |
108 | 108 | </ul> |
109 | 109 | ) |
110 | 110 | }, |
111 | | - { description: "Carte verticale avec badges dans le contenu" } |
| 111 | + { "description": "Carte verticale avec badges dans le contenu" } |
112 | 112 | ); |
113 | 113 |
|
114 | 114 | export const CardWithDetail = getStory( |
115 | 115 | { |
116 | 116 | ...defaultProps, |
117 | | - detail: "détail(optionnel)" |
| 117 | + "detail": "détail(optionnel)" |
118 | 118 | }, |
119 | | - { description: "Carte verticale avec détail" } |
| 119 | + { "description": "Carte verticale avec détail" } |
120 | 120 | ); |
121 | 121 |
|
122 | 122 | export const CardWithEndDetail = getStory( |
123 | 123 | { |
124 | 124 | ...defaultProps, |
125 | | - endDetail: "détail(optionnel)" |
| 125 | + "endDetail": "détail(optionnel)" |
126 | 126 | }, |
127 | | - { description: "Carte verticale avec détail en bas" } |
| 127 | + { "description": "Carte verticale avec détail en bas" } |
128 | 128 | ); |
129 | 129 |
|
130 | 130 | export const CardWithActionLinks = getStory( |
131 | 131 | { |
132 | 132 | ...defaultProps, |
133 | | - enlargeLink: false, |
134 | | - footer: ( |
135 | | - <ul className="fr-links-group"> |
| 133 | + "enlargeLink": false, |
| 134 | + "footer": ( |
| 135 | + <ul className={fr.cx("fr-links-group")}> |
136 | 136 | <li> |
137 | | - <a className="fr-link fr-icon-arrow-right-line fr-link--icon-right" href="#"> |
| 137 | + <a |
| 138 | + className={fr.cx( |
| 139 | + "fr-link", |
| 140 | + "fr-icon-arrow-right-line", |
| 141 | + "fr-link--icon-right" |
| 142 | + )} |
| 143 | + href="#" |
| 144 | + > |
138 | 145 | label |
139 | 146 | </a> |
140 | 147 | </li> |
141 | 148 | <li> |
142 | | - <a className="fr-link fr-icon-arrow-right-line fr-link--icon-right" href="#"> |
| 149 | + <a |
| 150 | + className={fr.cx( |
| 151 | + "fr-link", |
| 152 | + "fr-icon-arrow-right-line", |
| 153 | + "fr-link--icon-right" |
| 154 | + )} |
| 155 | + href="#" |
| 156 | + > |
143 | 157 | label |
144 | 158 | </a> |
145 | 159 | </li> |
146 | 160 | </ul> |
147 | 161 | ) |
148 | 162 | }, |
149 | | - { description: "Carte verticale avec liens d'action" } |
| 163 | + { "description": "Carte verticale avec liens d'action" } |
150 | 164 | ); |
151 | 165 |
|
152 | 166 | export const CardWithActionButtons = getStory( |
153 | 167 | { |
154 | 168 | ...defaultProps, |
155 | | - enlargeLink: false, |
156 | | - footer: ( |
157 | | - <ul className="fr-btns-group fr-btns-group--inline-reverse fr-btns-group--inline-lg"> |
| 169 | + "enlargeLink": false, |
| 170 | + "footer": ( |
| 171 | + <ul |
| 172 | + className={fr.cx( |
| 173 | + "fr-btns-group", |
| 174 | + "fr-btns-group--inline-reverse", |
| 175 | + "fr-btns-group--inline-lg" |
| 176 | + )} |
| 177 | + > |
158 | 178 | <li> |
159 | | - <button className="fr-btn fr-btn--secondary">Label</button> |
| 179 | + <button className={fr.cx("fr-btn", "fr-btn--secondary")}>Label</button> |
160 | 180 | </li> |
161 | 181 | <li> |
162 | | - <button className="fr-btn">Label</button> |
| 182 | + <button className={fr.cx("fr-btn")}>Label</button> |
163 | 183 | </li> |
164 | 184 | </ul> |
165 | 185 | ) |
166 | 186 | }, |
167 | | - { description: "Carte verticale avec buttons d'action" } |
| 187 | + { "description": "Carte verticale avec buttons d'action" } |
168 | 188 | ); |
169 | 189 |
|
170 | | -export const CardHorizontale = getStory( |
| 190 | +export const CardHorizontal = getStory( |
171 | 191 | { |
172 | 192 | ...defaultProps, |
173 | | - horizontal: true |
| 193 | + "horizontal": true |
174 | 194 | }, |
175 | | - { description: "Carte horizontale", defaultContainerWidth: 700 } |
| 195 | + { "description": "Carte horizontale", "defaultContainerWidth": 700 } |
176 | 196 | ); |
177 | 197 |
|
178 | | -export const CardHorizontaleSM = getStory( |
| 198 | +export const CardHorizontalSM = getStory( |
179 | 199 | { |
180 | 200 | ...defaultProps, |
181 | | - horizontal: true, |
182 | | - size: "small" |
| 201 | + "horizontal": true, |
| 202 | + "size": "small" |
183 | 203 | }, |
184 | | - { description: "Carte horizontale", defaultContainerWidth: 500 } |
| 204 | + { "description": "Carte horizontale", "defaultContainerWidth": 500 } |
185 | 205 | ); |
186 | 206 |
|
187 | 207 | export const CardHorizontaleLG = getStory( |
188 | 208 | { |
189 | 209 | ...defaultProps, |
190 | | - horizontal: true, |
191 | | - size: "large" |
| 210 | + "horizontal": true, |
| 211 | + "size": "large" |
192 | 212 | }, |
193 | | - { description: "Carte horizontale", defaultContainerWidth: 900 } |
| 213 | + { "description": "Carte horizontale", "defaultContainerWidth": 900 } |
194 | 214 | ); |
195 | 215 |
|
196 | | -export const CardHorizontaleWithoutImage = getStory( |
| 216 | +export const CardHorizontalWithoutImage = getStory( |
197 | 217 | { |
198 | 218 | ...defaultProps, |
199 | | - horizontal: true, |
200 | | - size: "large", |
201 | | - imageUrl: undefined, |
202 | | - detail: ( |
| 219 | + "horizontal": true, |
| 220 | + "size": "large", |
| 221 | + "imageUrl": undefined, |
| 222 | + "detail": ( |
203 | 223 | <ul className={fr.cx("fr-badges-group")}> |
204 | | - <Badge label="LABEL BADGE" /> |
205 | | - <Badge label="LABEL BADGE" severity="new" /> |
| 224 | + <Badge>LABEL BADGE</Badge> |
| 225 | + <Badge severity="new">LABEL BADGE</Badge> |
206 | 226 | </ul> |
207 | 227 | ) |
208 | 228 | }, |
209 | | - { description: "Carte horizontale sans image", defaultContainerWidth: 900 } |
| 229 | + { "description": "Carte horizontale sans image", "defaultContainerWidth": 900 } |
210 | 230 | ); |
211 | 231 |
|
212 | | -export const CardHorizontaleWithoutImageAndEnlargeLink = getStory( |
| 232 | +export const CardHorizontalWithoutImageAndEnlargeLink = getStory( |
213 | 233 | { |
214 | 234 | ...defaultProps, |
215 | | - horizontal: true, |
216 | | - enlargeLink: false, |
217 | | - size: "large", |
218 | | - imageUrl: undefined |
| 235 | + "horizontal": true, |
| 236 | + "enlargeLink": false, |
| 237 | + "size": "large", |
| 238 | + "imageUrl": undefined |
219 | 239 | }, |
220 | | - { description: "Carte horizontale sans image", defaultContainerWidth: 900 } |
| 240 | + { "description": "Carte horizontale sans image", "defaultContainerWidth": 900 } |
221 | 241 | ); |
222 | 242 |
|
223 | | -export const CardHorizontaleWithActions = getStory( |
| 243 | +export const CardHorizontalWithActions = getStory( |
224 | 244 | { |
225 | 245 | ...defaultProps, |
226 | | - enlargeLink: false, |
227 | | - horizontal: true, |
228 | | - size: "large", |
229 | | - badges: [<Badge label="LABEL BADGE" />], |
230 | | - detail: ( |
| 246 | + "enlargeLink": false, |
| 247 | + "horizontal": true, |
| 248 | + "size": "large", |
| 249 | + "badges": [<Badge>LABEL BADGE</Badge>], |
| 250 | + "detail": ( |
231 | 251 | <ul className={fr.cx("fr-badges-group")}> |
232 | | - <Badge label="LABEL BADGE" /> |
233 | | - <Badge label="LABEL BADGE" severity="new" /> |
| 252 | + <Badge>LABEL BADGE</Badge> |
| 253 | + <Badge severity="new">LABEL BADGE</Badge> |
234 | 254 | </ul> |
235 | 255 | ), |
236 | | - footer: ( |
237 | | - <ul className="fr-btns-group fr-btns-group--inline-reverse fr-btns-group--inline-lg"> |
| 256 | + "footer": ( |
| 257 | + <ul |
| 258 | + className={fr.cx( |
| 259 | + "fr-btns-group", |
| 260 | + "fr-btns-group--inline-reverse", |
| 261 | + "fr-btns-group--inline-lg" |
| 262 | + )} |
| 263 | + > |
238 | 264 | <li> |
239 | | - <button className="fr-btn fr-btn--secondary">Label</button> |
| 265 | + <button className={fr.cx("fr-btn", "fr-btn--secondary")}>Label</button> |
240 | 266 | </li> |
241 | 267 | <li> |
242 | | - <button className="fr-btn">Label</button> |
| 268 | + <button className={fr.cx("fr-btn")}>Label</button> |
243 | 269 | </li> |
244 | 270 | </ul> |
245 | 271 | ) |
246 | 272 | }, |
247 | | - { description: "Carte horizontale", defaultContainerWidth: 900 } |
| 273 | + { "description": "Carte horizontale", "defaultContainerWidth": 900 } |
248 | 274 | ); |
249 | 275 |
|
250 | 276 | export const CardGrey = getStory( |
251 | 277 | { |
252 | 278 | ...defaultProps, |
253 | | - horizontal: true, |
254 | | - grey: false |
| 279 | + "horizontal": true, |
| 280 | + "grey": false |
255 | 281 | }, |
256 | | - { description: "Carte horizontale grey", defaultContainerWidth: 900 } |
| 282 | + { "description": "Carte horizontale grey", "defaultContainerWidth": 900 } |
257 | 283 | ); |
0 commit comments