diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 14:14:00 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 14:14:00 +0800 |
commit | bfe708533fb424cef9b1659871982549eaf34e02 (patch) | |
tree | 6329c748e5c60c326e24dec57a9efb574227cb79 /packages/instant/src/components/ui | |
parent | d7742029c7ff991e60352cddeb52c2cdc1589a57 (diff) | |
parent | 771f8a6a6cff935631e8c6ebcdc012cdd3533de6 (diff) | |
download | dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar.gz dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar.bz2 dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar.lz dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar.xz dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.tar.zst dexon-sol-tools-bfe708533fb424cef9b1659871982549eaf34e02.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/dropdown-ui
Diffstat (limited to 'packages/instant/src/components/ui')
-rw-r--r-- | packages/instant/src/components/ui/container.tsx | 15 | ||||
-rw-r--r-- | packages/instant/src/components/ui/flex.tsx | 11 |
2 files changed, 16 insertions, 10 deletions
diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx index a0a187e5f..403751210 100644 --- a/packages/instant/src/components/ui/container.tsx +++ b/packages/instant/src/components/ui/container.tsx @@ -1,17 +1,18 @@ import { darken } from 'polished'; +import { MediaChoice, stylesForMedia } from '../../style/media'; import { ColorOption, styled } from '../../style/theme'; import { cssRuleIfExists } from '../../style/util'; export interface ContainerProps { - display?: string; + display?: MediaChoice; position?: string; top?: string; right?: string; bottom?: string; left?: string; - width?: string; - height?: string; + width?: MediaChoice; + height?: MediaChoice; maxWidth?: string; margin?: string; marginTop?: string; @@ -33,6 +34,7 @@ export interface ContainerProps { cursor?: string; overflow?: string; darkenOnHover?: boolean; + flexGrow?: string | number; } export const Container = @@ -40,14 +42,12 @@ export const Container = ContainerProps > ` box-sizing: border-box; - ${props => cssRuleIfExists(props, 'display')} + ${props => cssRuleIfExists(props, 'flex-grow')} ${props => cssRuleIfExists(props, 'position')} ${props => cssRuleIfExists(props, 'top')} ${props => cssRuleIfExists(props, 'right')} ${props => cssRuleIfExists(props, 'bottom')} ${props => cssRuleIfExists(props, 'left')} - ${props => cssRuleIfExists(props, 'width')} - ${props => cssRuleIfExists(props, 'height')} ${props => cssRuleIfExists(props, 'max-width')} ${props => cssRuleIfExists(props, 'margin')} ${props => cssRuleIfExists(props, 'margin-top')} @@ -65,6 +65,9 @@ export const Container = ${props => cssRuleIfExists(props, 'cursor')} ${props => cssRuleIfExists(props, 'overflow')} ${props => (props.hasBoxShadow ? `box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1)` : '')}; + ${props => props.display && stylesForMedia('display', props.display)} + ${props => stylesForMedia('width', props.width || 'auto')} + ${props => stylesForMedia('height', props.height || 'auto')} background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')}; &:hover { diff --git a/packages/instant/src/components/ui/flex.tsx b/packages/instant/src/components/ui/flex.tsx index 29c6511bb..fd218b0cd 100644 --- a/packages/instant/src/components/ui/flex.tsx +++ b/packages/instant/src/components/ui/flex.tsx @@ -1,3 +1,4 @@ +import { MediaChoice, stylesForMedia } from '../../style/media'; import { ColorOption, styled } from '../../style/theme'; import { cssRuleIfExists } from '../../style/util'; @@ -6,10 +7,11 @@ export interface FlexProps { flexWrap?: 'wrap' | 'nowrap'; justify?: 'flex-start' | 'center' | 'space-around' | 'space-between' | 'space-evenly' | 'flex-end'; align?: 'flex-start' | 'center' | 'space-around' | 'space-between' | 'space-evenly' | 'flex-end'; - width?: string; - height?: string; + width?: MediaChoice; + height?: MediaChoice; backgroundColor?: ColorOption; inline?: boolean; + flexGrow?: number | string; } export const Flex = @@ -19,11 +21,12 @@ export const Flex = display: ${props => (props.inline ? 'inline-flex' : 'flex')}; flex-direction: ${props => props.direction}; flex-wrap: ${props => props.flexWrap}; + ${props => cssRuleIfExists(props, 'flexGrow')} justify-content: ${props => props.justify}; align-items: ${props => props.align}; - ${props => cssRuleIfExists(props, 'width')} - ${props => cssRuleIfExists(props, 'height')} background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; + ${props => stylesForMedia('width', props.width || 'auto')} + ${props => stylesForMedia('height', props.height || 'auto')} `; Flex.defaultProps = { |