Created
November 8, 2018 13:24
-
-
Save morajabi/6977c33f056b306bdec6ab9461ff247e 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 styled, { css } from 'styled-components' | |
import { mobile } from '../style/media' | |
type Props = { | |
width?: number | |
height?: number | |
widthOnMobile?: number | |
heightOnMobile?: number | |
fillRow?: boolean | |
fillColumn?: boolean | |
} | |
export const Space = styled.div<Props>` | |
width: ${p => (typeof p.width === 'number' ? p.width + 'px' : 'auto')}; | |
height: ${p => (typeof p.height === 'number' ? p.height + 'px' : 'auto')}; | |
flex-shrink: 0; | |
${p => | |
mobile(css` | |
${typeof p.widthOnMobile === 'number' && | |
css` | |
width: ${p.widthOnMobile}px; | |
`}; | |
${typeof p.heightOnMobile === 'number' && | |
css` | |
height: ${p.heightOnMobile}px; | |
`}; | |
`)}; | |
${p => | |
p.fillRow && | |
css` | |
flex-grow: 1; | |
margin-right: auto; | |
margin-left: auto; | |
`}; | |
${p => | |
p.fillColumn && | |
css` | |
flex-grow: 1; | |
margin-top: auto; | |
margin-bottom: auto; | |
`}; | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment