Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0d0389
commit 15a2774
Showing
4 changed files
with
65 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import styled from 'styled-components'; | ||
import rgba from 'polished/lib/color/rgba'; | ||
import { DialogOverlay as ReachDialogOverlay } from '@reach/dialog'; | ||
|
||
/** | ||
* For further info, see the Reach UI documentation: | ||
* https://ui.reach.tech/dialog/ | ||
*/ | ||
const DialogOverlay = styled<any>(ReachDialogOverlay)( | ||
({ theme: { color, zIndex } }) => ({ | ||
position: 'fixed', | ||
top: '0', | ||
right: '0', | ||
bottom: '0', | ||
left: '0', | ||
overflow: 'auto', | ||
backgroundColor: color.gohan[100] && rgba(color.gohan[100], 0.75), | ||
zIndex: zIndex.dialog, | ||
}) | ||
); | ||
|
||
export default DialogOverlay; |
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,39 @@ | ||
--- | ||
name: Dialog Overlay | ||
menu: Components | ||
route: /components/dialog-overlay | ||
--- | ||
|
||
# Dialog Overlay | ||
|
||
A small pop-up window to display additional content or request action from the | ||
user. | ||
|
||
```jsx react-live | ||
() => { | ||
const [showDialog, setShowDialog] = React.useState(false); | ||
|
||
return ( | ||
<> | ||
<Button variant="secondary" onClick={() => setShowDialog(true)}> | ||
Open Dialog | ||
</Button> | ||
<DialogOverlay | ||
isOpen={showDialog} | ||
onDismiss={() => setShowDialog(false)} | ||
/> | ||
</> | ||
); | ||
}; | ||
``` | ||
|
||
## State | ||
|
||
Dialog is a styled extension of Reach UI's "Dialog" component, with state | ||
handled via `isOpen` and `onDismiss`. More information on these props, can be | ||
found in the [Reach UI documentation](https://ui.reach.tech/dialog). | ||
|
||
Examples on this page show usage with | ||
[React Hooks](https://reactjs.org/docs/hooks-intro.html), but this could also be | ||
handled via higher-order components or libaries such as | ||
[Recompose](https://github.com/acdlite/recompose). |
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