0.3.3-c • Published 5 years ago

react-simple-styling v0.3.3-c

Weekly downloads
22
License
MIT
Repository
github
Last release
5 years ago

React simple styling

Simple Vue-like library to create scoped styles for your React components!

NPM

Installation

npm i react-simple-styling

or

yarn add react-simple-styling

Usage

import

import { css, styleable } from 'react-simple-styling'

Get a style wrapper

const style = css`
  .message {
    width: 300px;
    margin: 0 auto;
    color: red;
  }
`;

and apply the css with it

const App = ()=> style(
  <div>
    <div className="message">
      Hello world!
    </div>
  </div>
);

Consuming className

No more manual extracting and applying className from props! styleable wrapper allows a component to consume className automatically:

const Card = ({children})=> (
  <div className="card-bg rounded p-2">
    {children}
  </div>
);

export default styleable(Card);

And the code below

const App = ()=> (
  <div>
    <Card className="test">
      Hello world!
    </Card>
  </div>
);

will be transformed into this:

<div>
  <div class="card-bg rounded p-2 test">
    Hello world!
  </div>
</div>

Theming

Now the library supports string interpolation. You can use it to manage themes easily.

const style = css`
  .border {
    border: 1px solid ${theme.accent}
  }
`;

CSS syntax highlighting

To bring syntax highlighting and autocomplete checkout the extenstions for styled-jsx which work with my module as well.

https://github.com/zeit/styled-jsx#syntax-highlighting

npm.io

Thanks to

0.3.3-c

5 years ago

0.3.3-b

5 years ago

0.3.3

5 years ago

0.3.2-b

5 years ago

0.3.2

5 years ago

0.3.1-d

5 years ago

0.3.1-c

5 years ago

0.3.1-b

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.9-b

5 years ago

0.2.9-a

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago