1 |
|
2 | import * as React from 'react'
|
3 | import defaultCss from 'css-jss'
|
4 |
|
5 | export const create = (css = defaultCss) =>
|
6 | function createElement(type, props) {
|
7 | const args = arguments
|
8 | if (props && props.css) {
|
9 | const className = css(props.css)
|
10 | const newProps = Object.assign({}, props)
|
11 | newProps.className = props.className ? `${props.className} ${className}` : className
|
12 | delete newProps.css
|
13 | args[1] = newProps
|
14 | }
|
15 | return React.createElement.apply(undefined, args)
|
16 | }
|
17 |
|
18 | export default create()
|