-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dialog: move files, add a story (#3019)
* Dialog: move files, add a story * storybook test * Update generated/components.json * add missing prop export --------- Co-authored-by: broccolinisoup <[email protected]>
- Loading branch information
1 parent
1f36733
commit 2d5ed00
Showing
10 changed files
with
120 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, {useState} from 'react' | ||
import {Meta} from '@storybook/react' | ||
|
||
import {BaseStyles, ThemeProvider} from '..' | ||
import {Button} from '../Button' | ||
import Dialog from './Dialog' | ||
|
||
export default { | ||
title: 'Components/Dialog', | ||
component: Dialog, | ||
decorators: [ | ||
Story => { | ||
// Since portal roots are registered globally, we need this line so that each storybook | ||
// story works in isolation. | ||
return ( | ||
<ThemeProvider> | ||
<BaseStyles> | ||
<Story /> | ||
</BaseStyles> | ||
</ThemeProvider> | ||
) | ||
}, | ||
], | ||
} as Meta | ||
|
||
export const Default = () => { | ||
const [isOpen, setIsOpen] = useState(false) | ||
const returnFocusRef = React.useRef(null) | ||
|
||
return ( | ||
<> | ||
<Button ref={returnFocusRef} onClick={() => setIsOpen(true)}> | ||
Open | ||
</Button> | ||
<Dialog | ||
returnFocusRef={returnFocusRef} | ||
isOpen={isOpen} | ||
onDismiss={() => setIsOpen(false)} | ||
aria-labelledby="header-id" | ||
> | ||
<Dialog.Header id="header-id">Title</Dialog.Header> | ||
some content | ||
</Dialog> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/__tests__/Dialog.test.tsx → src/Dialog/__tests__/Dialog.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/__tests__/Dialog.types.test.tsx → src/Dialog/__tests__/Dialog.types.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {default, DialogProps, DialogHeaderProps} from './Dialog' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters