Created
December 9, 2016 07:49
-
-
Save dnasca/619aa4f13c98e7f3f4836d04bbd3a8fc to your computer and use it in GitHub Desktop.
css-in-js example using Glamor
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { style, hover, active, media } from 'glamor'; | |
const button = { | |
backgroundColor: '#ff0000', | |
width: 320, | |
padding: 20, | |
borderRadius: 5, | |
border: 'none', | |
outline: 'none' | |
}; | |
const Button = () => ( | |
<div {...style({ textAlign: 'center' })}> | |
<button | |
{...style(button)} | |
{...hover({ color: '#fff' })} | |
{...active({ position: 'relative', top: 2 })} | |
{...media('(max-width: 480px)', { width: 160 })} | |
> | |
Click me! | |
</button> | |
</div> | |
); | |
ReactDOM.render(<Button />, document.getElementById('content')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment