react-get-styles
v0.2.4
Published
Helper to get object with styles from string or template string
Downloads
12
Readme
React Get Styles
Help you to get object with styles from string or template string such as:
// Input
const styles = gm`
border-radius: 3px;
flex-direction: column;
box-shadow: 3px 1px 10px rgba(0,0,0,0.3);
`
// Output
const styles = {
borderRadius: '3px',
flexDirection: 'column'
boxShadow: '3px 1px 10px rgba(0,0,0,0.3)'
}
Usage
npm install react-get-styles
import gs from 'react-get-styles'
const titleStyles = gs`
border-radius: 3px;
flex-direction: column;
box-shadow: 3px 1px 10px rgba(0,0,0,0.3);
`
const Title = ({ text }) => (
<h1 styles={titleStyles}>
{ text }
</h1>
)
This component uses Standard JS