-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathConfirmationDialog.stories.tsx
More file actions
78 lines (73 loc) · 1.7 KB
/
ConfirmationDialog.stories.tsx
File metadata and controls
78 lines (73 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Meta, StoryObj } from '@storybook/react-vite';
import { GridCenter } from '@/components/GridCenter';
import {
ConfirmationDialog,
ConfirmationDialogProps,
} from '@/components/ConfirmationDialog';
const ConfirmationDialogExample = ({
disabled,
loading,
message,
onCancel,
onConfirm,
open,
primaryActionLabel,
secondaryActionLabel,
showClose,
title,
}: ConfirmationDialogProps) => (
<GridCenter>
<ConfirmationDialog
disabled={disabled}
loading={loading}
message={message}
onCancel={onCancel}
onConfirm={onConfirm}
open={open}
primaryActionLabel={primaryActionLabel}
secondaryActionLabel={secondaryActionLabel}
showClose={showClose}
title={title}
></ConfirmationDialog>
</GridCenter>
);
const meta: Meta<typeof ConfirmationDialogExample> = {
component: ConfirmationDialogExample,
title: 'Display/ConfirmationDialog',
tags: ['autodocs', 'confirmation dialog'],
argTypes: {
open: {
options: [true, false, undefined],
control: { type: 'radio' },
},
},
};
export default meta;
type Story = StoryObj<typeof ConfirmationDialogExample>;
export const Playground: Story = {
args: {
title: 'Example dialog title',
disabled: false,
loading: false,
message:
'This is a simple dialog that cab be used to ask a confirmation of the action requested',
open: true,
onCancel: () => {
console.log('Cancel');
},
onConfirm: () => {
console.log('Click');
},
primaryActionLabel: 'Confirm',
secondaryActionLabel: 'Cancel',
showClose: false,
},
parameters: {
docs: {
story: {
inline: false,
iframeHeight: 500,
},
},
},
};