Skip to content

Commit

Permalink
fix: Dialog story, proper use of Dialog and DialogTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Seedy authored Dec 10, 2021
1 parent 4f9d0e1 commit e31bf0d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/Dialog/Dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { Dialog, DialogContent } from './Dialog';
import { Dialog, DialogContent, DialogTrigger, DialogClose } from './Dialog';
import { Text } from '../Text';
import { useState } from 'react';
import { Button } from '../Button';
Expand Down Expand Up @@ -39,8 +39,10 @@ export const Basic: ComponentStory<any> = (args) => {
const [open, setOpen] = useState(false);

return (
<>
<Button onClick={() => setOpen(true)}>Open dialog</Button>
<Dialog open={open} onOpenChange={(isOpen) => setOpen(isOpen)}>
<DialogTrigger asChild>
<Button onClick={() => setOpen(true)}>Open dialog</Button>
</DialogTrigger>

<Box>
{[...Array(10)].map((_, i) => (
Expand All @@ -55,11 +57,9 @@ export const Basic: ComponentStory<any> = (args) => {
))}
</Box>

<Dialog open={open} onOpenChange={(isOpen) => setOpen(isOpen)}>
<DialogContent>
<Content />
</DialogContent>
</Dialog>
</>
<DialogContent>
<Content />
</DialogContent>
</Dialog>
);
};

0 comments on commit e31bf0d

Please sign in to comment.