chore: address PR feedback
This commit is contained in:
@@ -2,6 +2,11 @@ import { Keyframes } from 'styled-components';
|
|||||||
|
|
||||||
import { css, keyframes, styled } from '../../style/theme';
|
import { css, keyframes, styled } from '../../style/theme';
|
||||||
|
|
||||||
|
export interface TransitionInfo {
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
}
|
||||||
|
|
||||||
const generateTransitionInfoCss = (
|
const generateTransitionInfoCss = (
|
||||||
key: keyof TransitionInfo,
|
key: keyof TransitionInfo,
|
||||||
top?: TransitionInfo,
|
top?: TransitionInfo,
|
||||||
@@ -39,11 +44,6 @@ const slideKeyframeGenerator = (
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export interface TransitionInfo {
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PositionAnimationSettings {
|
export interface PositionAnimationSettings {
|
||||||
top?: TransitionInfo;
|
top?: TransitionInfo;
|
||||||
bottom?: TransitionInfo;
|
bottom?: TransitionInfo;
|
||||||
@@ -74,3 +74,7 @@ export const PositionAnimation =
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
PositionAnimation.defaultProps = {
|
||||||
|
position: 'relative',
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ export type SlideAnimationState = 'slidIn' | 'slidOut' | 'none';
|
|||||||
export interface SlideAnimationProps {
|
export interface SlideAnimationProps {
|
||||||
position: string;
|
position: string;
|
||||||
animationState: SlideAnimationState;
|
animationState: SlideAnimationState;
|
||||||
slideIn: PositionAnimationSettings;
|
slideInSettings: PositionAnimationSettings;
|
||||||
slideOut: PositionAnimationSettings;
|
slideOutSettings: PositionAnimationSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = props => {
|
export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = props => {
|
||||||
if (props.animationState === 'none') {
|
if (props.animationState === 'none') {
|
||||||
return <React.Fragment>{props.children}</React.Fragment>;
|
return <React.Fragment>{props.children}</React.Fragment>;
|
||||||
}
|
}
|
||||||
const propsToUse = props.animationState === 'slidIn' ? props.slideIn : props.slideOut;
|
const propsToUse = props.animationState === 'slidIn' ? props.slideInSettings : props.slideOutSettings;
|
||||||
return (
|
return (
|
||||||
<PositionAnimation position={props.position} {...propsToUse}>
|
<PositionAnimation position={props.position} {...propsToUse}>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
|
import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { BuyButton } from '../components/buy_button';
|
|
||||||
import { SecondaryButton } from '../components/secondary_button';
|
|
||||||
import { Flex } from '../components/ui/flex';
|
|
||||||
|
|
||||||
import { PlacingOrderButton } from '../components/placing_order_button';
|
|
||||||
import { ColorOption } from '../style/theme';
|
import { ColorOption } from '../style/theme';
|
||||||
import { OrderProcessState, ZeroExInstantError } from '../types';
|
import { OrderProcessState, ZeroExInstantError } from '../types';
|
||||||
|
|
||||||
import { Button } from './ui/button';
|
import { BuyButton } from './buy_button';
|
||||||
import { Text } from './ui/text';
|
import { PlacingOrderButton } from './placing_order_button';
|
||||||
|
import { SecondaryButton } from './secondary_button';
|
||||||
|
import { Button, Flex, Text } from './ui';
|
||||||
|
|
||||||
export interface BuyOrderStateButtonProps {
|
export interface BuyOrderStateButtonProps {
|
||||||
buyQuote?: BuyQuote;
|
buyQuote?: BuyQuote;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export interface ERC20AssetAmountInputProps {
|
|||||||
asset?: ERC20Asset;
|
asset?: ERC20Asset;
|
||||||
value?: BigNumberInput;
|
value?: BigNumberInput;
|
||||||
onChange: (value?: BigNumberInput, asset?: ERC20Asset) => void;
|
onChange: (value?: BigNumberInput, asset?: ERC20Asset) => void;
|
||||||
onSymbolClick?: (asset?: ERC20Asset) => void;
|
onSelectAssetClick?: (asset?: ERC20Asset) => void;
|
||||||
startingFontSizePx: number;
|
startingFontSizePx: number;
|
||||||
fontColor?: ColorOption;
|
fontColor?: ColorOption;
|
||||||
isDisabled: boolean;
|
isDisabled: boolean;
|
||||||
@@ -40,7 +40,7 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
|
|||||||
const { asset } = this.props;
|
const { asset } = this.props;
|
||||||
return (
|
return (
|
||||||
<Container whiteSpace="nowrap">
|
<Container whiteSpace="nowrap">
|
||||||
{!_.isUndefined(asset) ? this._renderContentForAsset(asset) : this._renderBackupContent()}
|
{_.isUndefined(asset) ? this._renderBackupContent() : this._renderContentForAsset(asset)}
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -111,8 +111,8 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
private readonly _handleSymbolClick = () => {
|
private readonly _handleSymbolClick = () => {
|
||||||
if (this.props.onSymbolClick) {
|
if (this.props.onSelectAssetClick) {
|
||||||
this.props.onSymbolClick(this.props.asset);
|
this.props.onSelectAssetClick(this.props.asset);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// For assets with symbols of different length,
|
// For assets with symbols of different length,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export interface InstantHeadingProps {
|
|||||||
ethUsdPrice?: BigNumber;
|
ethUsdPrice?: BigNumber;
|
||||||
quoteRequestState: AsyncProcessState;
|
quoteRequestState: AsyncProcessState;
|
||||||
buyOrderState: OrderState;
|
buyOrderState: OrderState;
|
||||||
onSymbolClick?: (asset?: ERC20Asset) => void;
|
onSelectAssetClick?: (asset?: ERC20Asset) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PLACEHOLDER_COLOR = ColorOption.white;
|
const PLACEHOLDER_COLOR = ColorOption.white;
|
||||||
@@ -50,7 +50,7 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
|
|||||||
<Flex height="60px">
|
<Flex height="60px">
|
||||||
<SelectedERC20AssetAmountInput
|
<SelectedERC20AssetAmountInput
|
||||||
startingFontSizePx={38}
|
startingFontSizePx={38}
|
||||||
onSymbolClick={this.props.onSymbolClick}
|
onSelectAssetClick={this.props.onSelectAssetClick}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex direction="column" justify="space-between">
|
<Flex direction="column" justify="space-between">
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ import * as React from 'react';
|
|||||||
|
|
||||||
import { ColorOption } from '../style/theme';
|
import { ColorOption } from '../style/theme';
|
||||||
|
|
||||||
import { Button } from './ui/button';
|
import { Button, Container, Spinner, Text } from './ui';
|
||||||
import { Container } from './ui/container';
|
|
||||||
import { Spinner } from './ui/spinner';
|
|
||||||
import { Text } from './ui/text';
|
|
||||||
|
|
||||||
export const PlacingOrderButton: React.StatelessComponent<{}> = props => (
|
export const PlacingOrderButton: React.StatelessComponent<{}> = props => (
|
||||||
<Button isDisabled={true} width="100%">
|
<Button isDisabled={true} width="100%">
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import * as React from 'react';
|
|||||||
|
|
||||||
import { ColorOption } from '../style/theme';
|
import { ColorOption } from '../style/theme';
|
||||||
|
|
||||||
import { Button, ButtonProps } from './ui/button';
|
import { Button, ButtonProps, Text } from './ui';
|
||||||
import { Text } from './ui/text';
|
|
||||||
|
|
||||||
export interface SecondaryButtonProps extends ButtonProps {}
|
export interface SecondaryButtonProps extends ButtonProps {}
|
||||||
|
|
||||||
|
|||||||
@@ -37,14 +37,14 @@ export interface SlidingErrorProps extends ErrorProps {
|
|||||||
}
|
}
|
||||||
export const SlidingError: React.StatelessComponent<SlidingErrorProps> = props => {
|
export const SlidingError: React.StatelessComponent<SlidingErrorProps> = props => {
|
||||||
const slideAmount = '120px';
|
const slideAmount = '120px';
|
||||||
const slideUp: PositionAnimationSettings = {
|
const slideUpSettings: PositionAnimationSettings = {
|
||||||
timingFunction: 'ease-in',
|
timingFunction: 'ease-in',
|
||||||
top: {
|
top: {
|
||||||
from: slideAmount,
|
from: slideAmount,
|
||||||
to: '0px',
|
to: '0px',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const slideDown: PositionAnimationSettings = {
|
const slideDownSettings: PositionAnimationSettings = {
|
||||||
timingFunction: 'cubic-bezier(0.25, 0.1, 0.25, 1)',
|
timingFunction: 'cubic-bezier(0.25, 0.1, 0.25, 1)',
|
||||||
top: {
|
top: {
|
||||||
from: '0px',
|
from: '0px',
|
||||||
@@ -54,8 +54,8 @@ export const SlidingError: React.StatelessComponent<SlidingErrorProps> = props =
|
|||||||
return (
|
return (
|
||||||
<SlideAnimation
|
<SlideAnimation
|
||||||
position="relative"
|
position="relative"
|
||||||
slideIn={slideUp}
|
slideInSettings={slideUpSettings}
|
||||||
slideOut={slideDown}
|
slideOutSettings={slideDownSettings}
|
||||||
animationState={props.animationState}
|
animationState={props.animationState}
|
||||||
>
|
>
|
||||||
<Error icon={props.icon} message={props.message} />
|
<Error icon={props.icon} message={props.message} />
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const SlidingPanel: React.StatelessComponent<SlidingPanelProps> = props =
|
|||||||
}
|
}
|
||||||
const { animationState, ...rest } = props;
|
const { animationState, ...rest } = props;
|
||||||
const slideAmount = '100%';
|
const slideAmount = '100%';
|
||||||
const slideUp: PositionAnimationSettings = {
|
const slideUpSettings: PositionAnimationSettings = {
|
||||||
duration: '0.3s',
|
duration: '0.3s',
|
||||||
timingFunction: 'ease-in-out',
|
timingFunction: 'ease-in-out',
|
||||||
top: {
|
top: {
|
||||||
@@ -38,7 +38,7 @@ export const SlidingPanel: React.StatelessComponent<SlidingPanelProps> = props =
|
|||||||
to: '0px',
|
to: '0px',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const slideDown: PositionAnimationSettings = {
|
const slideDownSettings: PositionAnimationSettings = {
|
||||||
duration: '0.3s',
|
duration: '0.3s',
|
||||||
timingFunction: 'ease-out',
|
timingFunction: 'ease-out',
|
||||||
top: {
|
top: {
|
||||||
@@ -47,7 +47,12 @@ export const SlidingPanel: React.StatelessComponent<SlidingPanelProps> = props =
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<SlideAnimation position="absolute" slideIn={slideUp} slideOut={slideDown} animationState={animationState}>
|
<SlideAnimation
|
||||||
|
position="absolute"
|
||||||
|
slideInSettings={slideUpSettings}
|
||||||
|
slideOutSettings={slideDownSettings}
|
||||||
|
animationState={animationState}
|
||||||
|
>
|
||||||
<Panel {...rest} />
|
<Panel {...rest} />
|
||||||
</SlideAnimation>
|
</SlideAnimation>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export { Text, Title } from './text';
|
export { Text, Title } from './text';
|
||||||
export { Button } from './button';
|
export { Button, ButtonProps } from './button';
|
||||||
export { Flex } from './flex';
|
export { Flex, FlexProps } from './flex';
|
||||||
export { Container } from './container';
|
export { Container, ContainerProps } from './container';
|
||||||
export { Input } from './input';
|
export { Input, InputProps } from './input';
|
||||||
export { Icon } from './icon';
|
export { Icon, IconProps } from './icon';
|
||||||
export { Spinner } from './spinner';
|
export { Spinner, SpinnerProps } from './spinner';
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
|
|||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
>
|
>
|
||||||
<Flex direction="column" justify="flex-start">
|
<Flex direction="column" justify="flex-start">
|
||||||
<SelectedAssetInstantHeading onSymbolClick={this._handleSymbolClick} />
|
<SelectedAssetInstantHeading onSelectAssetClick={this._handleSymbolClick} />
|
||||||
<LatestBuyQuoteOrderDetails />
|
<LatestBuyQuoteOrderDetails />
|
||||||
<Container padding="20px" width="100%">
|
<Container padding="20px" width="100%">
|
||||||
<SelectedAssetBuyOrderStateButtons />
|
<SelectedAssetBuyOrderStateButtons />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { AsyncProcessState, ERC20Asset, OrderState } from '../types';
|
|||||||
import { InstantHeading } from '../components/instant_heading';
|
import { InstantHeading } from '../components/instant_heading';
|
||||||
|
|
||||||
export interface InstantHeadingProps {
|
export interface InstantHeadingProps {
|
||||||
onSymbolClick?: (asset?: ERC20Asset) => void;
|
onSelectAssetClick?: (asset?: ERC20Asset) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ConnectedState {
|
interface ConnectedState {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { errorFlasher } from '../util/error_flasher';
|
|||||||
export interface SelectedERC20AssetAmountInputProps {
|
export interface SelectedERC20AssetAmountInputProps {
|
||||||
fontColor?: ColorOption;
|
fontColor?: ColorOption;
|
||||||
startingFontSizePx: number;
|
startingFontSizePx: number;
|
||||||
onSymbolClick?: (asset?: ERC20Asset) => void;
|
onSelectAssetClick?: (asset?: ERC20Asset) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ConnectedState {
|
interface ConnectedState {
|
||||||
|
|||||||
Reference in New Issue
Block a user