Update GenerateOrderForm and FillOrder components

This commit is contained in:
Brandon Millman
2018-06-05 23:34:20 -07:00
parent 03854baf53
commit 1677817d9f
4 changed files with 34 additions and 6 deletions

View File

@@ -39,6 +39,8 @@ interface FillOrderProps {
initialOrder: Order;
dispatcher: Dispatcher;
lastForceTokenStateRefetch: number;
isFullWidth?: boolean;
shouldRenderHeader?: boolean;
}
interface FillOrderState {
@@ -61,6 +63,10 @@ interface FillOrderState {
}
export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
public static defaultProps: Partial<FillOrderProps> = {
isFullWidth: false,
shouldRenderHeader: true,
};
private _isUnmounted: boolean;
constructor(props: FillOrderProps) {
super(props);
@@ -97,10 +103,15 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
this._isUnmounted = true;
}
public render(): React.ReactNode {
const rootClassName = this.props.isFullWidth ? 'clearfix' : 'lg-px4 md-px4 sm-px2';
return (
<div className="clearfix lg-px4 md-px4 sm-px2" style={{ minHeight: 600 }}>
<h3>Fill an order</h3>
<Divider />
<div className={rootClassName} style={{ minHeight: 600 }}>
{this.props.shouldRenderHeader && (
<div>
<h3>Fill an order</h3>
<Divider />
</div>
)}
<div>
{!this.props.isOrderInUrl && (
<div>

View File

@@ -47,6 +47,8 @@ interface GenerateOrderFormProps {
sideToAssetToken: SideToAssetToken;
tokenByAddress: TokenByAddress;
lastForceTokenStateRefetch: number;
isFullWidth?: boolean;
shouldRenderHeader?: boolean;
}
interface GenerateOrderFormState {
@@ -56,6 +58,10 @@ interface GenerateOrderFormState {
}
export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, GenerateOrderFormState> {
public static defaultProps: Partial<GenerateOrderFormProps> = {
isFullWidth: false,
shouldRenderHeader: true,
};
constructor(props: GenerateOrderFormProps) {
super(props);
this.state = {
@@ -80,10 +86,15 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
const exchangeContractIfExists = this.props.blockchain.getExchangeContractAddressIfExists();
const initialTakerAddress =
this.props.orderTakerAddress === constants.NULL_ADDRESS ? '' : this.props.orderTakerAddress;
const rootClassName = this.props.isFullWidth ? 'clearfix mb2' : 'clearfix mb2 lg-px4 md-px4 sm-px2';
return (
<div className="clearfix mb2 lg-px4 md-px4 sm-px2">
<h3>Generate an order</h3>
<Divider />
<div className={rootClassName}>
{this.props.shouldRenderHeader && (
<div>
<h3>Generate an order</h3>
<Divider />
</div>
)}
<div className="mx-auto" style={{ maxWidth: 580 }}>
<div className="pt3">
<div className="mx-auto clearfix">

View File

@@ -451,6 +451,8 @@ export class Portal extends React.Component<PortalProps, PortalState> {
blockchain={this._blockchain}
hashData={this.props.hashData}
dispatcher={this.props.dispatcher}
isFullWidth={true}
shouldRenderHeader={false}
/>
);
}
@@ -470,6 +472,8 @@ export class Portal extends React.Component<PortalProps, PortalState> {
tokenByAddress={this.props.tokenByAddress}
dispatcher={this.props.dispatcher}
lastForceTokenStateRefetch={this.props.lastForceTokenStateRefetch}
isFullWidth={true}
shouldRenderHeader={false}
/>
);
}

View File

@@ -13,6 +13,8 @@ interface GenerateOrderFormProps {
blockchain: Blockchain;
hashData: HashData;
dispatcher: Dispatcher;
isFullWidth?: boolean;
shouldRenderHeader?: boolean;
}
interface ConnectedState {