@@ -8,6 +8,9 @@ import type { Equals } from "tsafe";
88const { meta, getStory } = getStoryFactory ( {
99 sectionName,
1010 "wrappedComponent" : { Alert } ,
11+ "description" : `
12+ - [See DSFR documentation](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/alerte)
13+ - [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Alert.tsx)` ,
1114 "argTypes" : {
1215 "severity" : {
1316 "options" : ( ( ) => {
@@ -19,19 +22,26 @@ const { meta, getStory } = getStoryFactory({
1922 } ) ( ) ,
2023 "control" : { "type" : "radio" }
2124 } ,
25+ "title" : {
26+ "description" : `Required when the \`<Alert isSmall={false} />\`
27+ (which is the default if \`isSmall\` isn't specified).
28+ `
29+ } ,
30+ "description" : {
31+ "description" : "Required when the `<Alert isSmall />`"
32+ } ,
2233 "isClosable" : {
2334 "description" : "If the modal should have a close button"
2435 } ,
2536 "onClose" : {
2637 "description" : "Called when the user clicks the close button"
2738 } ,
2839 "isClosed" : {
29- "description" : [
30- "If specified the `<Alert />` is in [controlled mode](https://reactjs.org/docs/forms.html#controlled-components)" ,
31- "this means that when the close button is clicked" ,
32- "the `onClose()` callback will be called but you are responsible" ,
33- "for setting `isClosed` to `false`, the `<Alert />` wont close itself."
34- ] . join ( " " ) ,
40+ "description" : `If specified the \`<Alert />\` is in
41+ [controlled mode](https://reactjs.org/docs/forms.html#controlled-components)
42+ this means that when the close button is clicked
43+ the \`onClose()\` callback will be called but you are responsible
44+ for setting \`isClosed\` to \`false\`, the \`<Alert />\` wont close itself.` ,
3545 "control" : { "type" : null }
3646 }
3747 }
@@ -41,16 +51,38 @@ export default meta;
4151
4252export const Default = getStory ( {
4353 "severity" : "success" ,
54+ "isSmall" : false ,
4455 "title" : "Message successfully sent" ,
4556 "description" : "Everything went well" ,
4657 "isClosable" : true ,
4758 "isClosed" : undefined ,
4859 ...logCallbacks ( [ "onClose" ] )
4960} ) ;
5061
51- export const Small = getStory ( {
52- "severity" : "info" ,
53- "isSmall" : true ,
54- "title" : "Info: this is a small alert" ,
55- "description" : "This is the description"
62+ export const SmallDescriptionOnlyInfo = getStory (
63+ {
64+ "severity" : "info" ,
65+ "isSmall" : true ,
66+ "description" : "This is the description"
67+ } ,
68+ {
69+ "description" : "Small info `Alert` with only a description"
70+ }
71+ ) ;
72+
73+ export const TitleOnlyWarning = getStory (
74+ {
75+ "severity" : "warning" ,
76+ "title" : "This is the title"
77+ } ,
78+ {
79+ "description" : "Warning `Alert` with only a title"
80+ }
81+ ) ;
82+
83+ export const Error = getStory ( {
84+ "severity" : "error" ,
85+ "title" : "This is the title" ,
86+ "description" : "This is the description" ,
87+ "isClosable" : true
5688} ) ;
0 commit comments