systyle
TypeScript icon, indicating that this package has built-in type declarations

2.4.1 • Public • Published

Systyle

A set of moulinette helpers to style components through their props.

Example: creating a styled system for hyperapp

import { h } from "hyperapp"
import { createStyled } from 'systyle'
import { cx, css as emotion } from 'emotion'

const hyperappBuilder = moulinette =>
  function Styled(props, children) {
    const {
      as: type, = 'div',
      css = [],
      className = '',
      ...props
    } = moulinette(props)

    return h(type, { ...props, className: cx(className, emotion(css)) }, children) />
  }

const Styled = createStyled(hyperappBuilder)

const App = props => (
  <Styled as="main" display="flex" flexDirection="column">
    <Styled as="h1">Hi</Styled>
    <Styled as="span">Some text</Styled>
  </Styled>
)

Using a styled component

See react-systyle documentation

Readme

Keywords

none

Package Sidebar

Install

npm i systyle

Weekly Downloads

3

Version

2.4.1

License

none

Unpacked Size

26.4 kB

Total Files

15

Last publish

Collaborators

  • jflx