diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-01 04:47:05 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-01 04:47:05 +0800 |
commit | 12d34707b70e4784719593ec8d7ea57c5e601856 (patch) | |
tree | 263e872f0dc042f4dd0dfcc85c7ecc403ba83415 /packages/instant/src/components/ui/container.tsx | |
parent | ab631060a05fc6344ef6e2de7b0e6a0f0096e8ed (diff) | |
parent | f496096ce154e51ae0317cc91fd55d062eb6ec4f (diff) | |
download | dexon-0x-contracts-12d34707b70e4784719593ec8d7ea57c5e601856.tar.gz dexon-0x-contracts-12d34707b70e4784719593ec8d7ea57c5e601856.tar.zst dexon-0x-contracts-12d34707b70e4784719593ec8d7ea57c5e601856.zip |
Merge branch 'development' into feature/instant/prod-env-switches-cdn
Diffstat (limited to 'packages/instant/src/components/ui/container.tsx')
-rw-r--r-- | packages/instant/src/components/ui/container.tsx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx index 4dafe1386..e7d909d92 100644 --- a/packages/instant/src/components/ui/container.tsx +++ b/packages/instant/src/components/ui/container.tsx @@ -27,7 +27,9 @@ export interface ContainerProps { borderBottom?: string; className?: string; backgroundColor?: ColorOption; + rawBackgroundColor?: string; hasBoxShadow?: boolean; + isHidden?: boolean; zIndex?: number; whiteSpace?: string; opacity?: number; @@ -38,6 +40,16 @@ export interface ContainerProps { flexGrow?: string | number; } +const getBackgroundColor = (theme: any, backgroundColor?: ColorOption, rawBackgroundColor?: string): string => { + if (backgroundColor) { + return theme[backgroundColor] as string; + } + if (rawBackgroundColor) { + return rawBackgroundColor; + } + return 'none'; +}; + export const Container = styled.div < ContainerProps > @@ -70,7 +82,8 @@ export const Container = ${props => props.width && stylesForMedia<string>('width', props.width)} ${props => props.height && stylesForMedia<string>('height', props.height)} ${props => props.borderRadius && stylesForMedia<string>('border-radius', props.borderRadius)} - background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; + ${props => (props.isHidden ? 'visibility: hidden;' : '')} + background-color: ${props => getBackgroundColor(props.theme, props.backgroundColor, props.rawBackgroundColor)}; border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')}; &:hover { ${props => |