Set up scaffolding for new drawer

This commit is contained in:
Brandon Millman
2018-05-15 16:18:49 -07:00
parent bd7fc780cb
commit 317ff81744
3 changed files with 28 additions and 9 deletions

View File

@@ -18,6 +18,7 @@ import { Dispatcher } from 'ts/redux/dispatcher';
import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants'; import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate'; import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';
export enum TopBarDisplayType { export enum TopBarDisplayType {
Default, Default,
@@ -202,6 +203,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</div> </div>
); );
const popoverContent = <Menu style={{ color: colors.darkGrey }}>{developerSectionMenuItems}</Menu>; const popoverContent = <Menu style={{ color: colors.darkGrey }}>{developerSectionMenuItems}</Menu>;
// TODO : Remove this once we ship portal v2
const shouldShowPortalV2Drawer = this._isViewingPortal() && utils.shouldShowPortalV2();
return ( return (
<div style={{ ...styles.topBar, ...bottomBorderStyle, ...this.props.style, ...{ height } }} className="pb1"> <div style={{ ...styles.topBar, ...bottomBorderStyle, ...this.props.style, ...{ height } }} className="pb1">
<div className={parentClassNames}> <div className={parentClassNames}>
@@ -274,10 +277,22 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</div> </div>
</div> </div>
</div> </div>
{this._renderDrawer()} {shouldShowPortalV2Drawer ? this._renderPortalV2Drawer() : this._renderDrawer()}
</div> </div>
); );
} }
private _renderPortalV2Drawer(): React.ReactNode {
return (
<Drawer
open={this.state.isDrawerOpen}
docked={false}
openSecondary={true}
onRequestChange={this._onMenuButtonClick.bind(this)}
>
<div />
</Drawer>
);
}
private _renderDrawer(): React.ReactNode { private _renderDrawer(): React.ReactNode {
return ( return (
<Drawer <Drawer

View File

@@ -34,8 +34,9 @@ import 'less/all.less';
// cause we only want to import the module when the user navigates to the page. // cause we only want to import the module when the user navigates to the page.
// At the same time webpack statically parses for System.import() to determine bundle chunk split points // At the same time webpack statically parses for System.import() to determine bundle chunk split points
// so each lazy import needs it's own `System.import()` declaration. // so each lazy import needs it's own `System.import()` declaration.
const LazyPortal =
utils.isDevelopment() || utils.isStaging() || utils.isDogfood() // TODO: Remove this once we ship V2
const LazyPortal = utils.shouldShowPortalV2()
? createLazyComponent('Portal', async () => ? createLazyComponent('Portal', async () =>
System.import<any>(/* webpackChunkName: "portal" */ 'ts/containers/portal'), System.import<any>(/* webpackChunkName: "portal" */ 'ts/containers/portal'),
) )

View File

@@ -314,4 +314,7 @@ export const utils = {
return _.includes(window.location.href, configs.DOMAIN_STAGING); return _.includes(window.location.href, configs.DOMAIN_STAGING);
}, },
isDogfood, isDogfood,
shouldShowPortalV2(): boolean {
return this.isDevelopment() || this.isStaging() || this.isDogfood();
},
}; };