Skip to content

Commit 0286fe5

Browse files
committed
readme, formatting
1 parent 9501dcf commit 0286fe5

3 files changed

Lines changed: 36 additions & 34 deletions

File tree

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
# Styled JSS
1+
# Styled Components on top of JSS.
22

33
## Usage
44

5-
### With Styled Creator
5+
### With default styled function
6+
7+
```js
8+
import { styled } from 'styled-jss'
69

7-
Styled Creator allows to share classes between styled primitives
10+
const Button = styled('button', {
11+
fontSize: 12,
12+
color: (props) => props.theme.textColor
13+
})
814

9-
```jsx
15+
// Composition.
16+
const PrimaryButton = styled(Button, {
17+
color: 'red'
18+
})
19+
```
20+
21+
### With base style sheet
22+
23+
Using base style sheet we can share classes between styled primitives.
24+
25+
```js
1026
import Styled from 'styled-jss'
1127
import injectSheet from 'react-jss'
1228

@@ -22,11 +38,11 @@ const styled = Styled({
2238

2339
const NormalButton = styled('button', {
2440
composes: '$baseButton',
25-
border: '1px solid grey'
41+
border: [1, 'solid', 'grey'],
2642
color: 'black'
2743
})
2844

29-
// Composition over styled() same like styled-components
45+
// Composition - same way.
3046
const PrimaryButton = styled(NormalButton, {
3147
color: 'red'
3248
})
@@ -41,29 +57,14 @@ const MyComponent = ({classes}) => (
4157
const MyStyledComponent = injectSheet(styled.styles)(MyComponent)
4258
```
4359

44-
### With default styled function
45-
46-
```jsx
47-
import { styled } from 'styled-jss'
48-
49-
const Button = styled('button', {
50-
fontSize: 12,
51-
color: (props) => props.theme.textColor
52-
})
53-
54-
const PrimaryButton = styled(Button, {
55-
color: 'red'
56-
})
57-
```
58-
5960
### With custom JSS setup:
6061

6162
#### For Styled Creator:
62-
```jsx
63-
import {create as createJss} from 'jss'
64-
import {create as createInjectSheet} from 'react-jss'
65-
import vendorPrefixer from 'jss-vendor-prefixer'
6663

64+
```js
65+
import { create as createJss } from 'jss'
66+
import { create as createInjectSheet } from 'react-jss'
67+
import vendorPrefixer from 'jss-vendor-prefixer'
6768
import { setStyledCreator, prepareStyled } from 'styled-jss'
6869

6970
const jss = createJss()

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jss-styled",
3-
"version": "0.0.1",
4-
"description": "Styled primitives with JSS",
3+
"version": "0.1.0",
4+
"description": "Styled Components on top of JSS.",
55
"main": "lib/index.js",
66
"scripts": {
77
"clean": "rimraf lib/*",

src/utils/filter-props.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import isNativeProp from 'is-react-prop'
22

3-
4-
export default (props: Object) => Object
5-
.entries(props)
6-
.reduce((acc, [name, value]) => (isNativeProp(name)
7-
? {...acc, [name]: value}
8-
: acc
9-
), {})
3+
export default (props: Object) => (
4+
Object
5+
.entries(props)
6+
.reduce((acc, [name, value]) => (isNativeProp(name)
7+
? {...acc, [name]: value}
8+
: acc
9+
), {})
10+
)

0 commit comments

Comments
 (0)