Last active
December 31, 2019 09:52
-
-
Save bogdanq/1af9e7f44ed12e87a5854c7df1514129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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