Created
November 20, 2017 05:07
-
-
Save loklaan/715df70a9d52af0d32574cbcb9a972f3 to your computer and use it in GitHub Desktop.
Brief showcase of all styling sources exposed by element-styles.
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 { styled, StylesProvider } from 'element-styles' | |
// 1. Default styles | |
const defaults = { | |
container: { border: 'solid 3px currentColor', background: 'white' }, | |
inner: { color: 'currentColor' } | |
} | |
@styled(defaults) | |
class Button extends Component { ... } | |
// 2. Local overriding styles | |
const localOverrides = { | |
container: { background: 'papayawhip' } | |
} | |
<Button styles={localOverrides} /> | |
// 3. “Global” overriding styles | |
const componentSelectors = { | |
'Button': { | |
inner: { fontWeight: 'bold' } | |
} | |
} | |
const App = () => ( | |
<StylesProvider components={componentSelectors}> | |
<Button>Hey!</Button> | |
</StylesProvider> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment