Created
October 7, 2017 01:21
-
-
Save streamich/a14bc9eaa9ad7a4674ae0d7d84e743d4 to your computer and use it in GitHub Desktop.
Dynamic CSS for React components using React's v16 element array render result
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
class Button extends Component { | |
@css` | |
background-color: #ff0000; | |
width: 320px; | |
padding: 20px; | |
border-radius: 5px; | |
border: none; | |
outline: none; | |
&:hover { | |
color: #fff; | |
} | |
&:active { | |
position: relative; | |
top: 2px; | |
} | |
@media (max-width: 480px) { | |
& { | |
width: 160px; | |
} | |
} | |
`; | |
render() { | |
return <button>{this.props.children}</button>; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment