Last active
August 28, 2020 16:38
-
-
Save ryanflorence/5a99e069aca0a35d51e66f2d7fde5b80 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Adds a lovely fade in of the modal | |
// and a gentle slide-down of the modal content | |
class Demo extends React.Component { | |
state = { showDialog: false }; | |
render() { | |
return ( | |
<div> | |
<button onClick={() => this.setState({ showDialog: true })}> | |
Show Dialog | |
</button> | |
<Transition | |
from={{ opacity: 0, y: -10 }} | |
enter={{ opacity: 1, y: 0 }} | |
leave={{ opacity: 0, y: 10 }} | |
> | |
{this.state.showDialog && | |
(styles => ( | |
<DialogOverlay style={{ opacity: styles.opacity }}> | |
<DialogContent | |
style={{ | |
transform: `translate3d(0px, ${styles.y}px, 0px)`, | |
border: "4px solid hsla(0, 0%, 0%, 0.5)", | |
borderRadius: 10 | |
}} | |
> | |
<button onClick={() => this.setState({ showDialog: false })}> | |
Close Dialog | |
</button> | |
<p>React Spring makes it too easy!</p> | |
</DialogContent> | |
</DialogOverlay> | |
))} | |
</Transition> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Eventually will live at https://reach.tech/ui