Add Background component
This commit is contained in:
committed by
fragosti
parent
bd03151c2a
commit
79edc12c76
@@ -22,6 +22,7 @@ import { RelayerIndex } from 'ts/components/relayer_index/relayer_index';
|
|||||||
import { TokenBalances } from 'ts/components/token_balances';
|
import { TokenBalances } from 'ts/components/token_balances';
|
||||||
import { TopBar, TopBarDisplayType } from 'ts/components/top_bar/top_bar';
|
import { TopBar, TopBarDisplayType } from 'ts/components/top_bar/top_bar';
|
||||||
import { TradeHistory } from 'ts/components/trade_history/trade_history';
|
import { TradeHistory } from 'ts/components/trade_history/trade_history';
|
||||||
|
import { Background } from 'ts/components/ui/background';
|
||||||
import { Container } from 'ts/components/ui/container';
|
import { Container } from 'ts/components/ui/container';
|
||||||
import { FlashMessage } from 'ts/components/ui/flash_message';
|
import { FlashMessage } from 'ts/components/ui/flash_message';
|
||||||
import { Island } from 'ts/components/ui/island';
|
import { Island } from 'ts/components/ui/island';
|
||||||
@@ -109,22 +110,16 @@ const MENU_PADDING_LEFT = 185;
|
|||||||
const LARGE_LAYOUT_MAX_WIDTH = 1200;
|
const LARGE_LAYOUT_MAX_WIDTH = 1200;
|
||||||
|
|
||||||
const styles: Styles = {
|
const styles: Styles = {
|
||||||
root: {
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
backgroundColor: colors.lightestGrey,
|
|
||||||
},
|
|
||||||
body: {
|
body: {
|
||||||
height: `calc(100vh - ${TOP_BAR_HEIGHT}px)`,
|
marginTop: TOP_BAR_HEIGHT,
|
||||||
},
|
},
|
||||||
leftColumn: {
|
leftColumn: {
|
||||||
width: LEFT_COLUMN_WIDTH,
|
width: LEFT_COLUMN_WIDTH,
|
||||||
height: '100%',
|
position: 'fixed',
|
||||||
},
|
},
|
||||||
scrollContainer: {
|
scrollContainer: {
|
||||||
height: `calc(100vh - ${TOP_BAR_HEIGHT}px)`,
|
marginLeft: LEFT_COLUMN_WIDTH + 30,
|
||||||
WebkitOverflowScrolling: 'touch',
|
marginRight: 30,
|
||||||
overflow: 'auto',
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -245,7 +240,8 @@ export class Portal extends React.Component<PortalProps, PortalState> {
|
|||||||
? TokenVisibility.UNTRACKED
|
? TokenVisibility.UNTRACKED
|
||||||
: TokenVisibility.TRACKED;
|
: TokenVisibility.TRACKED;
|
||||||
return (
|
return (
|
||||||
<div style={styles.root}>
|
<div>
|
||||||
|
<Background />
|
||||||
<DocumentTitle title="0x Portal DApp" />
|
<DocumentTitle title="0x Portal DApp" />
|
||||||
<TopBar
|
<TopBar
|
||||||
userAddress={this.props.userAddress}
|
userAddress={this.props.userAddress}
|
||||||
@@ -259,7 +255,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
|
|||||||
blockchain={this._blockchain}
|
blockchain={this._blockchain}
|
||||||
translate={this.props.translate}
|
translate={this.props.translate}
|
||||||
displayType={TopBarDisplayType.Expanded}
|
displayType={TopBarDisplayType.Expanded}
|
||||||
style={{ backgroundColor: colors.lightestGrey }}
|
style={{ backgroundColor: colors.lightestGrey, position: 'fixed' }}
|
||||||
maxWidth={LARGE_LAYOUT_MAX_WIDTH}
|
maxWidth={LARGE_LAYOUT_MAX_WIDTH}
|
||||||
/>
|
/>
|
||||||
<div id="portal" style={styles.body}>
|
<div id="portal" style={styles.body}>
|
||||||
@@ -709,10 +705,10 @@ interface LargeLayoutProps {
|
|||||||
const LargeLayout = (props: LargeLayoutProps) => {
|
const LargeLayout = (props: LargeLayoutProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto flex flex-center" style={{ maxWidth: LARGE_LAYOUT_MAX_WIDTH }}>
|
<div className="mx-auto flex flex-center" style={{ maxWidth: LARGE_LAYOUT_MAX_WIDTH }}>
|
||||||
<div className="flex-last px2">
|
<div className="flex-last">
|
||||||
<div style={styles.leftColumn}>{props.left}</div>
|
<div style={styles.leftColumn}>{props.left}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-auto px2" style={styles.scrollContainer}>
|
<div className="flex-auto" style={styles.scrollContainer}>
|
||||||
{props.right}
|
{props.right}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
24
packages/website/ts/components/ui/background.tsx
Normal file
24
packages/website/ts/components/ui/background.tsx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import { colors } from '@0xproject/react-shared';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { styled } from 'ts/style/theme';
|
||||||
|
import { zIndex } from 'ts/style/z_index';
|
||||||
|
|
||||||
|
export interface BackgroundProps {
|
||||||
|
color?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PlainBackground: React.StatelessComponent<BackgroundProps> = props => <div {...props} />;
|
||||||
|
|
||||||
|
export const Background = styled(PlainBackground)`
|
||||||
|
background-color: ${props => props.color};
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
position: fixed;
|
||||||
|
z-index: ${zIndex.background};
|
||||||
|
`;
|
||||||
|
|
||||||
|
Background.defaultProps = {
|
||||||
|
color: colors.lightestGrey,
|
||||||
|
};
|
||||||
|
|
||||||
|
Background.displayName = 'Background';
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export const zIndex = {
|
export const zIndex = {
|
||||||
|
background: -1,
|
||||||
topBar: 1100,
|
topBar: 1100,
|
||||||
overlay: 1105,
|
overlay: 1105,
|
||||||
aboveOverlay: 1106,
|
aboveOverlay: 1106,
|
||||||
|
|||||||
Reference in New Issue
Block a user