Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created December 9, 2016 07:49
Show Gist options
  • Save dnasca/619aa4f13c98e7f3f4836d04bbd3a8fc to your computer and use it in GitHub Desktop.
Save dnasca/619aa4f13c98e7f3f4836d04bbd3a8fc to your computer and use it in GitHub Desktop.
css-in-js example using Glamor
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