feat(website): implement link directly to configure

This commit is contained in:
Brandon Millman 2018-11-28 13:46:41 -08:00
parent e1c237a8e4
commit 63cb312c7f
4 changed files with 36 additions and 6 deletions

View File

@ -3,4 +3,10 @@ import * as React from 'react';
import { Container } from 'ts/components/ui/container'; import { Container } from 'ts/components/ui/container';
import { colors } from 'ts/style/colors'; import { colors } from 'ts/style/colors';
export const Configurator = () => <Container height="400px" backgroundColor={colors.instantTertiaryBackground} />; export interface ConfiguratorProps {
hash: string;
}
export const Configurator = (props: ConfiguratorProps) => (
<Container id={props.hash} height="400px" backgroundColor={colors.instantTertiaryBackground} />
);

View File

@ -1,3 +1,4 @@
import { utils as sharedUtils } from '@0x/react-shared';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import * as DocumentTitle from 'react-document-title'; import * as DocumentTitle from 'react-document-title';
@ -26,6 +27,7 @@ export interface InstantProps {
export interface InstantState {} export interface InstantState {}
const CONFIGURATOR_HASH = 'configure';
const THROTTLE_TIMEOUT = 100; const THROTTLE_TIMEOUT = 100;
const DOCUMENT_TITLE = '0x Instant'; const DOCUMENT_TITLE = '0x Instant';
const DOCUMENT_DESCRIPTION = '0x Instant'; const DOCUMENT_DESCRIPTION = '0x Instant';
@ -42,7 +44,6 @@ export class Instant extends React.Component<InstantProps, InstantState> {
window.scrollTo(0, 0); window.scrollTo(0, 0);
} }
public render(): React.ReactNode { public render(): React.ReactNode {
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
return ( return (
<Container overflowX="hidden"> <Container overflowX="hidden">
<MetaTags title={DOCUMENT_TITLE} description={DOCUMENT_DESCRIPTION} /> <MetaTags title={DOCUMENT_TITLE} description={DOCUMENT_DESCRIPTION} />
@ -55,15 +56,30 @@ export class Instant extends React.Component<InstantProps, InstantState> {
isNightVersion={true} isNightVersion={true}
/> />
<Container backgroundColor={colors.instantPrimaryBackground} /> <Container backgroundColor={colors.instantPrimaryBackground} />
<Introducing0xInstant screenWidth={this.props.screenWidth} /> <Introducing0xInstant screenWidth={this.props.screenWidth} onCTAClick={this._onHeaderCTAClick} />
<Screenshots screenWidth={this.props.screenWidth} /> <Screenshots screenWidth={this.props.screenWidth} />
<Features screenWidth={this.props.screenWidth} /> <Features screenWidth={this.props.screenWidth} />
{!isSmallScreen && <Configurator />} {!this._isSmallScreen() && <Configurator hash={CONFIGURATOR_HASH} />}
<NeedMore screenWidth={this.props.screenWidth} /> <NeedMore screenWidth={this.props.screenWidth} />
<Footer translate={this.props.translate} dispatcher={this.props.dispatcher} /> <Footer translate={this.props.translate} dispatcher={this.props.dispatcher} />
</Container> </Container>
); );
} }
private readonly _onHeaderCTAClick = () => {
if (this._isSmallScreen()) {
utils.openUrl(`${utils.getCurrentBaseUrl()}/wiki#About`);
} else {
this._scrollToConfigurator();
}
};
private _isSmallScreen(): boolean {
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
return isSmallScreen;
}
private _scrollToConfigurator(): void {
sharedUtils.setUrlHash(CONFIGURATOR_HASH);
sharedUtils.scrollToHash(CONFIGURATOR_HASH, '');
}
private _updateScreenWidth(): void { private _updateScreenWidth(): void {
const newScreenWidth = utils.getScreenWidth(); const newScreenWidth = utils.getScreenWidth();
this.props.dispatcher.updateScreenWidth(newScreenWidth); this.props.dispatcher.updateScreenWidth(newScreenWidth);

View File

@ -8,6 +8,7 @@ import { ScreenWidths } from 'ts/types';
export interface Introducing0xInstantProps { export interface Introducing0xInstantProps {
screenWidth: ScreenWidths; screenWidth: ScreenWidths;
onCTAClick: () => void;
} }
export const Introducing0xInstant = (props: Introducing0xInstantProps) => { export const Introducing0xInstant = (props: Introducing0xInstantProps) => {
@ -40,7 +41,13 @@ export const Introducing0xInstant = (props: Introducing0xInstantProps) => {
</Text> </Text>
</Container> </Container>
<div className="py3"> <div className="py3">
<Button type="button" backgroundColor={colors.mediumBlue} fontColor={colors.white} fontSize="18px"> <Button
type="button"
backgroundColor={colors.mediumBlue}
fontColor={colors.white}
fontSize="18px"
onClick={props.onCTAClick}
>
Get Started Get Started
</Button> </Button>
</div> </div>

View File

@ -5,6 +5,7 @@
"no-object-literal-type-assertion": false, "no-object-literal-type-assertion": false,
"completed-docs": false, "completed-docs": false,
"prefer-function-over-method": false, "prefer-function-over-method": false,
"custom-no-magic-numbers": false "custom-no-magic-numbers": false,
"semicolon": [true, "always", "ignore-bound-class-methods"]
} }
} }