Skip to content

Commit 97b59c4

Browse files
committed
Document an example of Dialog creation
1 parent d5c0f30 commit 97b59c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stories/Modal.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function Home(){
4646
{/* You can also call modal.close() to programmatically close the modal */}
4747
</>
4848
);
49-
);
49+
}
5050
\`\`\`
5151
5252
You can also register callbacks to be called when the modal is opened or closed:
@@ -61,6 +61,10 @@ useIsModalOpen(
6161
);
6262
\`\`\`
6363
64+
To create a Dialog component, something that you would use to ask the user a question, like "Do you want to proceed?", you can implement this pattern:
65+
- [Component](https://github.com/codegouvfr/react-dsfr/blob/main/test/integration/cra/src/MyDialog.tsx),
66+
- [Usage](https://github.com/codegouvfr/react-dsfr/blob/d5c0f304ed3416c8d10bba83e7a075a304d2caa0/test/integration/cra/src/Home.tsx#L117-L132).
67+
6468
`,
6569
"argTypes": {
6670
"title": {
@@ -124,6 +128,7 @@ function Template(args: ModalProps) {
124128
return (
125129
<>
126130
<Button nativeButtonProps={modal.buttonProps}>Open modal (stateless approach)</Button>
131+
&nbsp; - or - &nbsp;
127132
<Button onClick={() => modal.open()}>Open modal with modal.open()</Button>
128133
<modal.Component {...args} />
129134
</>

0 commit comments

Comments
 (0)