feat(instant): when on mobile, show mobile specific styling that takes up whole screen
This commit is contained in:
parent
f6487122d1
commit
a2bc62b17a
@ -1,5 +1,7 @@
|
||||
import * as _ from 'lodash';
|
||||
import { darken } from 'polished';
|
||||
|
||||
import { media } from '../../style/media';
|
||||
import { ColorOption, styled } from '../../style/theme';
|
||||
import { cssRuleIfExists } from '../../style/util';
|
||||
|
||||
@ -34,8 +36,22 @@ export interface ContainerProps {
|
||||
overflow?: string;
|
||||
darkenOnHover?: boolean;
|
||||
flexGrow?: string | number;
|
||||
|
||||
smallWidth?: string;
|
||||
smallHeight?: string;
|
||||
}
|
||||
|
||||
const mediaStyles = (props: ContainerProps) => {
|
||||
if (!_.some([props.smallWidth, props.smallHeight])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return media.small`
|
||||
width: ${props.smallWidth || props.width || 'auto'}
|
||||
height: ${props.smallHeight || props.height || 'auto'}
|
||||
`;
|
||||
};
|
||||
|
||||
// TODO Dont commit flex grow
|
||||
export const Container =
|
||||
styled.div <
|
||||
@ -68,6 +84,7 @@ 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 => mediaStyles(props)}
|
||||
background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')};
|
||||
border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')};
|
||||
&:hover {
|
||||
|
@ -1,3 +1,6 @@
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { media } from '../../style/media';
|
||||
import { ColorOption, styled } from '../../style/theme';
|
||||
import { cssRuleIfExists } from '../../style/util';
|
||||
|
||||
@ -11,8 +14,22 @@ export interface FlexProps {
|
||||
backgroundColor?: ColorOption;
|
||||
inline?: boolean;
|
||||
flexGrow?: number | string;
|
||||
|
||||
smallWidth?: string;
|
||||
smallHeight?: string;
|
||||
}
|
||||
|
||||
const mediaStyles = (props: FlexProps) => {
|
||||
if (!_.some([props.smallWidth, props.smallHeight])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return media.small`
|
||||
width: ${props.smallWidth || props.width || 'auto'}
|
||||
height: ${props.smallHeight || props.height || 'auto'}
|
||||
`;
|
||||
};
|
||||
|
||||
export const Flex =
|
||||
styled.div <
|
||||
FlexProps >
|
||||
@ -26,6 +43,7 @@ export const Flex =
|
||||
${props => cssRuleIfExists(props, 'width')}
|
||||
${props => cssRuleIfExists(props, 'height')}
|
||||
background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')};
|
||||
${props => mediaStyles(props)}
|
||||
`;
|
||||
|
||||
Flex.defaultProps = {
|
||||
|
@ -18,7 +18,7 @@ const PlainOverlay: React.StatelessComponent<OverlayProps> = ({ children, classN
|
||||
<Container position="absolute" top="0px" right="0px">
|
||||
<Icon height={18} width={18} color={ColorOption.white} icon="closeX" onClick={onClose} padding="2em 2em" />
|
||||
</Container>
|
||||
<Container width="100%" height="100%">
|
||||
<Container smallWidth="100%" smallHeight="100%">
|
||||
{children}
|
||||
</Container>
|
||||
</Flex>
|
||||
|
@ -26,7 +26,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
|
||||
};
|
||||
public render(): React.ReactNode {
|
||||
return (
|
||||
<Container width="100%" height="100%" position="relative">
|
||||
<Container width="350px" smallWidth="100%" smallHeight="100%" position="relative">
|
||||
<Container zIndex={zIndex.errorPopup} position="relative">
|
||||
<LatestError />
|
||||
</Container>
|
||||
@ -37,9 +37,9 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
|
||||
borderRadius="3px"
|
||||
hasBoxShadow={true}
|
||||
overflow="hidden"
|
||||
height="100%"
|
||||
smallHeight="100%"
|
||||
>
|
||||
<Flex direction="column" height="100%" justify="flex-start">
|
||||
<Flex direction="column" smallHeight="100%" justify="flex-start">
|
||||
<SelectedAssetInstantHeading onSelectAssetClick={this._handleSymbolClick} />
|
||||
<SelectedAssetBuyOrderProgress />
|
||||
<LatestBuyQuoteOrderDetails />
|
||||
|
19
packages/instant/src/style/media.ts
Normal file
19
packages/instant/src/style/media.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { css } from './theme';
|
||||
|
||||
export enum ScreenWidths {
|
||||
Sm = 40,
|
||||
Md = 52,
|
||||
Lg = 64,
|
||||
}
|
||||
|
||||
const generateMediaWrapper = (screenWidth: ScreenWidths) => (...args: any[]) => css`
|
||||
@media (max-width: ${screenWidth}em) {
|
||||
${css.apply(css, args)};
|
||||
}
|
||||
`;
|
||||
|
||||
export const media = {
|
||||
small: generateMediaWrapper(ScreenWidths.Sm),
|
||||
medium: generateMediaWrapper(ScreenWidths.Md),
|
||||
large: generateMediaWrapper(ScreenWidths.Lg),
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user