|
| 1 | +import type { Meta, StoryObj } from "@storybook/react"; |
| 2 | +import { Dialog } from "../src/main"; |
| 3 | +import { Button } from "../src/main"; |
| 4 | + |
| 5 | + |
| 6 | +const meta = { |
| 7 | + title: "Components/Dialog", |
| 8 | + component: Dialog, |
| 9 | + parameters: { |
| 10 | + layout: "centered", |
| 11 | + }, |
| 12 | + tags: ["autodocs"], |
| 13 | + args: { |
| 14 | + children: <p>This is basic dialog</p>, |
| 15 | + }, |
| 16 | + argTypes: { |
| 17 | + children: { |
| 18 | + description: "The content of the modal.you can use the `Dialog.Header`, `Dialog.Body`, and `Dialog.Footer` components to structure the content of the modal.", |
| 19 | + control: false |
| 20 | + }, |
| 21 | + } |
| 22 | +} satisfies Meta<typeof Dialog>; |
| 23 | + |
| 24 | +export default meta; |
| 25 | +type Story = StoryObj<typeof meta>; |
| 26 | + |
| 27 | +export const Default: Story = { |
| 28 | + name: "Default Dialog", |
| 29 | + render : ()=>{ |
| 30 | + return ( |
| 31 | + <> |
| 32 | + <Dialog> |
| 33 | + <Dialog.Header>title</Dialog.Header> |
| 34 | + <Dialog.Body>body</Dialog.Body> |
| 35 | + <Dialog.Footer> |
| 36 | + <Button color="black">cancel</Button> |
| 37 | + <Button>ok</Button> |
| 38 | + </Dialog.Footer> |
| 39 | + </Dialog> |
| 40 | + </> |
| 41 | + ) |
| 42 | + } |
| 43 | +}; |
| 44 | + |
| 45 | +export const HideHeaderCloseIcon: Story = { |
| 46 | + name: "Hide Close Icon", |
| 47 | + render : ()=>{ |
| 48 | + return ( |
| 49 | + <> |
| 50 | + <Dialog> |
| 51 | + <Dialog.Header hideCloseIcon >title</Dialog.Header> |
| 52 | + <Dialog.Body>body</Dialog.Body> |
| 53 | + <Dialog.Footer> |
| 54 | + <Button color="black">cancel</Button> |
| 55 | + <Button>ok</Button> |
| 56 | + </Dialog.Footer> |
| 57 | + </Dialog> |
| 58 | + </> |
| 59 | + ) |
| 60 | + } |
| 61 | +}; |
| 62 | + |
| 63 | +export const NoHeader: Story = { |
| 64 | + name: "Hide Header", |
| 65 | + render : ()=>{ |
| 66 | + return ( |
| 67 | + <> |
| 68 | + <Dialog> |
| 69 | + <Dialog.Body>body</Dialog.Body> |
| 70 | + <Dialog.Footer> |
| 71 | + <Button color="black">cancel</Button> |
| 72 | + <Button>ok</Button> |
| 73 | + </Dialog.Footer> |
| 74 | + </Dialog> |
| 75 | + </> |
| 76 | + ) |
| 77 | + } |
| 78 | +}; |
| 79 | + |
| 80 | +export const NoFooter: Story = { |
| 81 | + name: "Hide Footer", |
| 82 | + render : ()=>{ |
| 83 | + return ( |
| 84 | + <> |
| 85 | + <Dialog> |
| 86 | + <Dialog.Header>title</Dialog.Header> |
| 87 | + <Dialog.Body>body</Dialog.Body> |
| 88 | + </Dialog> |
| 89 | + </> |
| 90 | + ) |
| 91 | + } |
| 92 | +}; |
0 commit comments