Skip to content

Instantly share code, notes, and snippets.

@fpapado
Forked from tkh44/Box.js
Created December 6, 2017 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpapado/94dc9aafa91a572466cec97669b9ec54 to your computer and use it in GitHub Desktop.
Save fpapado/94dc9aafa91a572466cec97669b9ec54 to your computer and use it in GitHub Desktop.
styled-system with emotion.
import styled, { css } from 'emotion/react'
import { space, width, fontSize, color, responsiveStyle } from 'styled-system'
export const display = responsiveStyle('display')
export const flex = responsiveStyle('flex')
export const order = responsiveStyle('order')
const wrap = responsiveStyle('flex-wrap', 'wrap', 'wrap')
const direction = responsiveStyle('flexDirection', 'direction')
const align = responsiveStyle('alignItems', 'align')
const justify = responsiveStyle('justifyContent', 'justify')
const column = props => props.column ? css`flex-direction:column;` : null
const Box = styled('div')`
${display};
${space};
${width};
${fontSize};
${color};
${flex};
${order};
${wrap};
${column};
${direction};
${align};
${justify};
`
export default Box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment