1
1
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' ;
4
3
import { Stack } from '@components/Stack' ;
5
4
import { Text } from '@components/Typography' ;
6
5
import type { Meta , StoryObj } from '@storybook/react' ;
7
6
import React , { useState } from 'react' ;
8
7
9
- const meta : Meta < { title ?: string } & IModalProps > = {
8
+ const meta : Meta < IDialogProps > = {
10
9
title : 'Overlays/Dialog' ,
11
10
parameters : {
12
11
docs : {
@@ -17,14 +16,42 @@ A Dialog is a type of modal that is used to display information or prompt the us
17
16
} ,
18
17
} ,
19
18
} ,
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
+ } ,
20
44
} ;
21
45
22
46
export default meta ;
23
- type Story = StoryObj < IModalProps > ;
47
+ type Story = StoryObj < IDialogProps > ;
24
48
25
49
export const DialogStory : Story = {
26
50
name : 'Dialog' ,
27
- render : ( ) => {
51
+ args : {
52
+ title : 'Dialog Title' ,
53
+ } ,
54
+ render : ( { title } ) => {
28
55
const [ isOpen , setIsOpen ] = useState ( false ) ;
29
56
30
57
return (
@@ -33,7 +60,7 @@ export const DialogStory: Story = {
33
60
< Dialog
34
61
isOpen = { isOpen }
35
62
onOpenChange = { ( isOpen ) => setIsOpen ( isOpen ) }
36
- title = "Dialog Title"
63
+ title = { title }
37
64
>
38
65
{ ( state ) => (
39
66
< Stack direction = "column" gap = "$6" alignItems = "flex-end" >
0 commit comments