From 7b8db1156daec88fa691744230bb129efefdfa48 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 4 Jul 2018 14:27:46 -0700 Subject: Various fixes for portal on mobile and top bar layout --- packages/website/ts/components/portal/portal.tsx | 65 ++++++++++++++-------- packages/website/ts/components/top_bar/top_bar.tsx | 43 ++++++++------ .../ts/components/top_bar/top_bar_menu_item.tsx | 1 - packages/website/ts/components/wallet/wallet.tsx | 4 +- 4 files changed, 71 insertions(+), 42 deletions(-) (limited to 'packages/website/ts') diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index 1adbc86cd..d31de02bc 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -91,7 +91,7 @@ interface PortalState { interface AccountManagementItem { pathName: string; - headerText: string; + headerText?: string; render: () => React.ReactNode; } @@ -106,7 +106,8 @@ const TOP_BAR_HEIGHT = TopBar.heightForDisplayType(TopBarDisplayType.Expanded); const LEFT_COLUMN_WIDTH = 346; const MENU_PADDING_LEFT = 185; const LARGE_LAYOUT_MAX_WIDTH = 1200; -const LARGE_LAYOUT_MARGIN = 30; +const LARGE_LAYOUT_SIDE_PADDING = 30; +const SMALL_LAYOUT_SIDE_PADDING = 20; export class Portal extends React.Component { private _blockchain: Blockchain; @@ -243,7 +244,9 @@ export class Portal extends React.Component { position: 'fixed', zIndex: zIndex.topBar, }} - maxWidth={LARGE_LAYOUT_MAX_WIDTH} + maxWidth={!this._isSmallScreen() ? LARGE_LAYOUT_MAX_WIDTH : undefined} + paddingLeft={!this._isSmallScreen() ? LARGE_LAYOUT_SIDE_PADDING : SMALL_LAYOUT_SIDE_PADDING} + paddingRight={!this._isSmallScreen() ? LARGE_LAYOUT_SIDE_PADDING : SMALL_LAYOUT_SIDE_PADDING} /> @@ -324,7 +327,11 @@ export class Portal extends React.Component { return (
- {isMobile && {this._renderStartOnboarding()}} + {isMobile && ( + + {this._renderStartOnboarding()} + + )} { }, { pathName: `${WebsitePaths.Portal}/account`, - headerText: 'Your Account', + headerText: this._isSmallScreen() ? undefined : 'Your Account', render: this._isSmallScreen() ? this._renderWallet.bind(this) : this._renderTokenBalances.bind(this), }, { @@ -445,7 +452,7 @@ export class Portal extends React.Component { private _renderAccountManagementItem(item: AccountManagementItem): React.ReactNode { return (
} + header={!_.isUndefined(item.headerText) && } body={} /> ); @@ -527,15 +534,21 @@ export class Portal extends React.Component { ); } private _renderRelayerIndexSection(): React.ReactNode { - return
} body={this._renderRelayerIndex()} />; - } - private _renderRelayerIndex(): React.ReactNode { const isMobile = utils.isMobileWidth(this.props.screenWidth); return ( - - {isMobile && {this._renderStartOnboarding()}} - - +
} + body={ + + {isMobile && ( + + {this._renderStartOnboarding()} + + )} + + + } + /> ); } private _renderNotFoundMessage(): React.ReactNode { @@ -685,19 +698,19 @@ interface LargeLayoutProps { } const LargeLayout = (props: LargeLayoutProps) => { return ( - +
- + {props.left}
- - + + {props.right} @@ -711,7 +724,13 @@ interface SmallLayoutProps { const SmallLayout = (props: SmallLayoutProps) => { return (
-
{props.content}
+ + {props.content} +
); }; // tslint:disable:max-file-line-count diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 778536663..dd3de7950 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -11,6 +11,7 @@ import { LegacyPortalMenu } from 'ts/components/legacy_portal/legacy_portal_menu import { DrawerMenu } from 'ts/components/portal/drawer_menu'; import { ProviderDisplay } from 'ts/components/top_bar/provider_display'; import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item'; +import { Container } from 'ts/components/ui/container'; import { DropDown } from 'ts/components/ui/drop_down'; import { Dispatcher } from 'ts/redux/dispatcher'; import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; @@ -45,6 +46,8 @@ export interface TopBarProps { onVersionSelected?: (semver: string) => void; sidebarHeader?: React.ReactNode; maxWidth?: number; + paddingLeft?: number; + paddingRight?: number; } interface TopBarState { @@ -67,13 +70,12 @@ const styles: Styles = { color: colors.darkestGrey, paddingTop: 6, paddingBottom: 6, - marginTop: 17, cursor: 'pointer', fontWeight: 400, }, }; -const DEFAULT_HEIGHT = 59; +const DEFAULT_HEIGHT = 68; const EXPANDED_HEIGHT = 75; export class TopBar extends React.Component { @@ -81,6 +83,8 @@ export class TopBar extends React.Component { displayType: TopBarDisplayType.Default, style: {}, isNightVersion: false, + paddingLeft: 20, + paddingRight: 20, }; public static heightForDisplayType(displayType: TopBarDisplayType): number { const result = displayType === TopBarDisplayType.Expanded ? EXPANDED_HEIGHT : DEFAULT_HEIGHT; @@ -102,7 +106,9 @@ export class TopBar extends React.Component { public render(): React.ReactNode { const isNightVersion = this.props.isNightVersion; const isExpandedDisplayType = this.props.displayType === TopBarDisplayType.Expanded; - const parentClassNames = `flex mx-auto ${isExpandedDisplayType ? 'pl3 py1' : 'max-width-4'}`; + const parentClassNames = !isExpandedDisplayType + ? 'flex mx-auto items-center max-width-4' + : 'flex mx-auto items-center'; const height = isExpandedDisplayType ? EXPANDED_HEIGHT : DEFAULT_HEIGHT; const developerSectionMenuItems = [ @@ -197,7 +203,6 @@ export class TopBar extends React.Component { fontSize: 25, color: isNightVersion ? 'white' : 'black', cursor: 'pointer', - paddingTop: 16, }; const activeNode = (
@@ -211,15 +216,21 @@ export class TopBar extends React.Component { // TODO : Remove this once we ship portal v2 const shouldShowPortalV2Drawer = this._isViewingPortal() && utils.shouldShowPortalV2(); return ( -
-
-
- - - -
-
-
+
+ + + + +
{!this._isViewingPortal() && (
@@ -264,7 +275,7 @@ export class TopBar extends React.Component {
)} {this._isViewingPortal() && ( -
+
{ />
)} -
+
-
+ {shouldShowPortalV2Drawer ? this._renderPortalV2Drawer() : this._renderDrawer()}
); diff --git a/packages/website/ts/components/top_bar/top_bar_menu_item.tsx b/packages/website/ts/components/top_bar/top_bar_menu_item.tsx index 2e4254cfa..e96d27c3f 100644 --- a/packages/website/ts/components/top_bar/top_bar_menu_item.tsx +++ b/packages/website/ts/components/top_bar/top_bar_menu_item.tsx @@ -31,7 +31,6 @@ export class TopBarMenuItem extends React.Component { popoverContent={ - + {!isMobile && } - + {!isMobile && } } anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }} -- cgit v1.2.3