feature: add modal docz tests

This commit is contained in:
George Lima 2018-12-20 12:03:23 -03:00
parent 8c904d7a37
commit b14954de9a
2 changed files with 60 additions and 0 deletions

57
app/components/modal.mdx Normal file
View File

@ -0,0 +1,57 @@
---
name: Modal
---
import { Playground, PropsTable } from 'docz'
import { ModalComponent } from './modal.js'
# Modal
## Properties
<PropsTable of={ModalComponent} />
## Basic usage
<Playground>
<ModalComponent
renderTrigger={toggleVisibility => (
<button type="button" onClick={toggleVisibility}>
Open Modal
</button>
)}
>
{toggleVisibility => (
<div style={{ padding: '50px', backgroundColor: 'white' }}>
Modal Content
<button type="button" onClick={toggleVisibility}>
Close Modal
</button>
</div>
)}
</ModalComponent>
</Playground>
## Don't close with ESC or backdrop click
<Playground>
<ModalComponent
closeOnEsc={false}
closeOnBackdropClick={false}
renderTrigger={toggleVisibility => (
<button type="button" onClick={toggleVisibility}>
Open Modal
</button>
)}
>
{toggleVisibility => (
<div style={{ padding: '50px', backgroundColor: 'white' }}>
Modal Content
<button type="button" onClick={toggleVisibility}>
Close Modal
</button>
</div>
)}
</ModalComponent>
</Playground>

View File

@ -14,5 +14,8 @@ export default {
},
],
},
body: {
raw: '<div id="modal-root" />',
},
},
};