diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-11-27 15:55:01 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-11-29 02:59:54 +0800 |
commit | f83c4c51c7bf4319da2833f4068e5804476be2a2 (patch) | |
tree | 9cc3c743f6c53d2bcce00a7f601df5d6d44acd9e | |
parent | 7a726e2740b8cbc885229ed377ef5fc89502301d (diff) | |
download | dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar.gz dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar.bz2 dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar.lz dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar.xz dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.tar.zst dexon-sol-tools-f83c4c51c7bf4319da2833f4068e5804476be2a2.zip |
feat(website): add header and footer to instant page
-rw-r--r-- | packages/website/ts/pages/instant/instant.tsx | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/packages/website/ts/pages/instant/instant.tsx b/packages/website/ts/pages/instant/instant.tsx index 0ecf39254..ae91d7094 100644 --- a/packages/website/ts/pages/instant/instant.tsx +++ b/packages/website/ts/pages/instant/instant.tsx @@ -1,12 +1,57 @@ +import * as _ from 'lodash'; import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; +import { Footer } from 'ts/components/footer'; +import { MetaTags } from 'ts/components/meta_tags'; +import { TopBar } from 'ts/components/top_bar/top_bar'; +import { Container } from 'ts/components/ui/container'; import { Dispatcher } from 'ts/redux/dispatcher'; +import { ScreenWidths } from 'ts/types'; import { Translate } from 'ts/utils/translate'; +import { utils } from 'ts/utils/utils'; export interface InstantProps { location: Location; translate: Translate; dispatcher: Dispatcher; + screenWidth: ScreenWidths; } -export const Instant: React.StatelessComponent<InstantProps> = () => <div />; +export interface InstantState {} + +const THROTTLE_TIMEOUT = 100; +const DOCUMENT_TITLE = 'Instant'; +const DOCUMENT_DESCRIPTION = 'Instant'; + +export class Instant extends React.Component<InstantProps, InstantState> { + // TODO: consolidate this small screen scaffolding into one place (its being used in portal and docs as well) + private readonly _throttledScreenWidthUpdate: () => void; + public constructor(props: InstantProps) { + super(props); + this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); + } + public componentDidMount(): void { + window.addEventListener('resize', this._throttledScreenWidthUpdate); + window.scrollTo(0, 0); + } + public render(): React.ReactNode { + return ( + <Container overflowX="hidden"> + <MetaTags title={DOCUMENT_TITLE} description={DOCUMENT_DESCRIPTION} /> + <DocumentTitle title={DOCUMENT_TITLE} /> + <TopBar + blockchainIsLoaded={false} + location={this.props.location} + style={{ position: 'relative' }} + translate={this.props.translate} + /> + <Footer translate={this.props.translate} dispatcher={this.props.dispatcher} /> + </Container> + ); + } + private _updateScreenWidth(): void { + const newScreenWidth = utils.getScreenWidth(); + this.props.dispatcher.updateScreenWidth(newScreenWidth); + } +} |