Skip to content

Instantly share code, notes, and snippets.

@bogdanq
Last active December 31, 2019 09:52
Show Gist options
  • Save bogdanq/1af9e7f44ed12e87a5854c7df1514129 to your computer and use it in GitHub Desktop.
Save bogdanq/1af9e7f44ed12e87a5854c7df1514129 to your computer and use it in GitHub Desktop.
import React from 'react'
import { css } from 'styled-components'
export const WithTag = ({ as = 'div', children, to, onClick, ...props }) =>
React.createElement(as, { to, onClick, ...props }, children)
const prop = value => (is(value) ? value : 'initial')
export const mixins = props => css`
align-content: ${prop(props.alignContent)};
align-items: ${prop(props.align)};
flex-basis: ${prop(props.basis)};
flex-grow: ${prop(props.grow)};
flex-shrink: ${prop(props.shrink)};
justify-content: ${prop(props.justify)};
order: ${prop(props.order)};
padding: ${prop(props.padding)};
width: ${prop(props.width)};
max-width: ${prop(props.maxW)};
`
const Container = styled(WithTag)`
${mixins}
width: 100%;
`
//usage
//<Container align="center" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment