Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/dropdown-ui
This commit is contained in:
@@ -35,7 +35,7 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
|
||||
value={this.state.searchQuery}
|
||||
onChange={this._handleSearchInputChange}
|
||||
/>
|
||||
<Container overflow="scroll" height="390px" marginTop="10px">
|
||||
<Container overflow="scroll" height={{ default: '390px', sm: '75vh' }} marginTop="10px">
|
||||
{_.map(tokens, token => {
|
||||
if (!this._isTokenQueryMatch(token)) {
|
||||
return null;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class OrderDetails extends React.Component<OrderDetailsProps> {
|
||||
const ethTokenFee = buyQuoteAccessor.feeEthAmount();
|
||||
const totalEthAmount = buyQuoteAccessor.totalEthAmount();
|
||||
return (
|
||||
<Container padding="20px" width="100%">
|
||||
<Container padding="20px" width="100%" flexGrow={1}>
|
||||
<Container marginBottom="10px">
|
||||
<Text
|
||||
letterSpacing="1px"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -26,7 +26,11 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
|
||||
};
|
||||
public render(): React.ReactNode {
|
||||
return (
|
||||
<Container width="350px" position="relative">
|
||||
<Container
|
||||
width={{ default: '350px', sm: '100%' }}
|
||||
height={{ default: 'auto', sm: '100%' }}
|
||||
position="relative"
|
||||
>
|
||||
<Container zIndex={zIndex.errorPopup} position="relative">
|
||||
<LatestError />
|
||||
</Container>
|
||||
@@ -37,8 +41,9 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
|
||||
borderRadius="3px"
|
||||
hasBoxShadow={true}
|
||||
overflow="hidden"
|
||||
height="100%"
|
||||
>
|
||||
<Flex direction="column" justify="flex-start">
|
||||
<Flex direction="column" height="100%" justify="flex-start">
|
||||
<SelectedAssetInstantHeading onSelectAssetClick={this._handleSymbolClick} />
|
||||
<PaymentMethod />
|
||||
<SelectedAssetBuyOrderProgress />
|
||||
|
||||
@@ -20,7 +20,7 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
|
||||
<ZeroExInstantProvider {...rest}>
|
||||
<Overlay zIndex={zIndex}>
|
||||
<Flex height="100vh">
|
||||
<Container position="absolute" top="0px" right="0px">
|
||||
<Container position="absolute" top="0px" right="0px" display={{ default: 'initial', sm: 'none' }}>
|
||||
<Icon
|
||||
height={18}
|
||||
width={18}
|
||||
@@ -30,7 +30,9 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
|
||||
padding="2em 2em"
|
||||
/>
|
||||
</Container>
|
||||
<ZeroExInstantContainer />
|
||||
<Container width={{ default: 'auto', sm: '100%' }} height={{ default: 'auto', sm: '100%' }}>
|
||||
<ZeroExInstantContainer />
|
||||
</Container>
|
||||
</Flex>
|
||||
</Overlay>
|
||||
</ZeroExInstantProvider>
|
||||
|
||||
43
packages/instant/src/style/media.ts
Normal file
43
packages/instant/src/style/media.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { InterpolationValue } from 'styled-components';
|
||||
|
||||
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)};
|
||||
}
|
||||
`;
|
||||
|
||||
const media = {
|
||||
small: generateMediaWrapper(ScreenWidths.Sm),
|
||||
medium: generateMediaWrapper(ScreenWidths.Md),
|
||||
large: generateMediaWrapper(ScreenWidths.Lg),
|
||||
};
|
||||
|
||||
export interface ScreenSpecifications {
|
||||
default: string;
|
||||
sm?: string;
|
||||
md?: string;
|
||||
lg?: string;
|
||||
}
|
||||
export type MediaChoice = string | ScreenSpecifications;
|
||||
export const stylesForMedia = (cssPropertyName: string, choice: MediaChoice): InterpolationValue[] => {
|
||||
if (typeof choice === 'string') {
|
||||
return css`
|
||||
${cssPropertyName}: ${choice};
|
||||
`;
|
||||
}
|
||||
|
||||
return css`
|
||||
${cssPropertyName}: ${choice.default};
|
||||
${choice.lg && media.large`${cssPropertyName}: ${choice.lg}`}
|
||||
${choice.md && media.medium`${cssPropertyName}: ${choice.md}`}
|
||||
${choice.sm && media.small`${cssPropertyName}: ${choice.sm}`}
|
||||
`;
|
||||
};
|
||||
Reference in New Issue
Block a user