react-get-styles
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

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

Dependencies (4)

Dev Dependencies (25)

Package Sidebar

Install

npm i react-get-styles

Weekly Downloads

2

Version

0.2.4

License

MIT

Unpacked Size

23.5 kB

Total Files

10

Last publish

Collaborators

  • gerardogallegos