0.2.4 • Published 3 years ago

react-get-styles v0.2.4

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

React Get Styles

Build Status

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

JavaScript Style Guide