3.1.0 • Published 4 years ago

@jacco-meijer/styled-system v3.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@jacco-meijer/styled-system

This package tries to mimic styled-system functionality and can be configured to be a drop in replacement.

Project status

Needs multi platform testing.

The tests need to be hooked up to Travis that properly runs the tests on Windows and Linux. It's been developed on macOs and builds on Netlify.

Responsive

Responsive styles are generated with facepaint.

Config

The styled-system package this package was based on has a fixed configuration. This implementation can be fully configured by a simple configuration file.

Use with emotionCss

Create an emotionCss function that can parse your styles:

// Use your own project specific config and theme here
import { defaultConfig } from '@jacco-meijer/styled-system'
import { defaultTheme } from '@jacco-meijer/styled-system'
import { styledSystem } from '@jacco-meijer/styled-system'

export const emotionCss = (props: any) =>
  styledSystem(defaultConfig, defaultTheme, { ncss: props.ncss })

A simple grid

/** @jsx jsx */
import { jsx } from '@emotion/core'
import { emotionCss } from './emotion-css'

export const Box = (props: any) => (
  <div
    css={emotionCss({ ncss: { boxSizing: 'border-box', ...props.ncss } })}
    children={props.children}
  />
)

export const Flex = (props: any) => (
  <div
    css={emotionCss({
      ncss: {
        boxSizing: 'border-box',
        display: 'flex',
        flexWrap: 'wrap',
        ...props.ncss,
      },
    })}
    children={props.children}
  />
)

export const Container = (props: any) => {
  return (
    <div
      css={emotionCss({
        ncss: { mx: 'auto', maxWidth: '1024px', ...props.ncss },
      })}
      children={props.children}
    />
  )
}

Link element example

/** @jsx jsx */
import { jsx } from '@emotion/core'
import { emotionCss } from './emotion-css'

export const ALink = (props: any) => (
  <a
    children={props.children}
    css={emotionCss({ ncss: { textDecoration: 'none', ...props.ncss } })}
    href={props.href}
  />
)
3.1.0

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.0

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-beta.16

5 years ago

2.0.0-beta.15

5 years ago

2.0.0-beta.14

5 years ago

2.0.0-beta.13

5 years ago

2.0.0-beta.12

5 years ago

2.0.0-beta.11

5 years ago

2.0.0-beta.10

5 years ago

2.0.0-beta.9

5 years ago

2.0.0-beta.8

5 years ago

2.0.0-beta.7

5 years ago

2.0.0-beta.6

5 years ago

2.0.0-beta.5

5 years ago

2.0.0-beta.4

5 years ago

2.0.0-beta.3

5 years ago

2.0.0-beta.2

5 years ago

2.0.0-beta.1

5 years ago

2.0.0-beta.0

5 years ago

2.0.0-alpha.5

5 years ago

2.0.0-alpha.4

5 years ago

2.0.0-alpha.3

5 years ago

2.0.0-alpha.2

5 years ago

2.0.0-alpha.1

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

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.3

5 years ago