Skip to content

Commit e98a7ca

Browse files
committed
improving storybook
1 parent 394d9b3 commit e98a7ca

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

packages/libs/react-ui/src/components/Dialog/Dialog.stories.tsx

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { Button } from '@components/Button';
2-
import { Dialog } from '@components/Dialog';
3-
import type { IModalProps } from '@components/Modal';
2+
import { Dialog, IDialogProps } from '@components/Dialog';
43
import { Stack } from '@components/Stack';
54
import { Text } from '@components/Typography';
65
import type { Meta, StoryObj } from '@storybook/react';
76
import React, { useState } from 'react';
87

9-
const meta: Meta<{ title?: string } & IModalProps> = {
8+
const meta: Meta<IDialogProps> = {
109
title: 'Overlays/Dialog',
1110
parameters: {
1211
docs: {
@@ -17,14 +16,42 @@ A Dialog is a type of modal that is used to display information or prompt the us
1716
},
1817
},
1918
},
19+
argTypes: {
20+
isOpen: {
21+
description:
22+
'Controls whether the dialog is open or closed. If true, the dialog will be open. If false, the dialog will be closed.',
23+
table: {
24+
defaultValue: { summary: 'false' },
25+
type: { summary: 'boolean' },
26+
},
27+
},
28+
onOpenChange: {
29+
control: { type: 'function' },
30+
description:
31+
'Function that is called when the dialog is opened or closed. It is passed a boolean value that indicates whether the dialog is open or closed.',
32+
table: {
33+
type: { summary: 'function' },
34+
},
35+
},
36+
title: {
37+
control: { type: 'text' },
38+
description: 'Title of the dialog.',
39+
table: {
40+
type: { summary: 'string' },
41+
},
42+
},
43+
},
2044
};
2145

2246
export default meta;
23-
type Story = StoryObj<IModalProps>;
47+
type Story = StoryObj<IDialogProps>;
2448

2549
export const DialogStory: Story = {
2650
name: 'Dialog',
27-
render: () => {
51+
args: {
52+
title: 'Dialog Title',
53+
},
54+
render: ({ title }) => {
2855
const [isOpen, setIsOpen] = useState(false);
2956

3057
return (
@@ -33,7 +60,7 @@ export const DialogStory: Story = {
3360
<Dialog
3461
isOpen={isOpen}
3562
onOpenChange={(isOpen) => setIsOpen(isOpen)}
36-
title="Dialog Title"
63+
title={title}
3764
>
3865
{(state) => (
3966
<Stack direction="column" gap="$6" alignItems="flex-end">

0 commit comments

Comments
 (0)