import { colors, Link } from '@0x/react-shared'; import * as _ from 'lodash'; import * as React from 'react'; import DocumentTitle from 'react-document-title'; import { Footer } from 'ts/components/footer'; import { TopBar } from 'ts/components/top_bar/top_bar'; import { Button } from 'ts/components/ui/button'; import { Container } from 'ts/components/ui/container'; import { Image } from 'ts/components/ui/image'; import { Text } from 'ts/components/ui/text'; import { Dispatcher } from 'ts/redux/dispatcher'; import { Deco, Key, ScreenWidths, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; import { utils } from 'ts/utils/utils'; export interface LaunchKitProps { location: Location; translate: Translate; dispatcher: Dispatcher; } interface LaunchKitState { screenWidth: ScreenWidths; } const THROTTLE_TIMEOUT = 100; const lighterBackgroundColor = '#222222'; const darkerBackgroundColor = '#1B1B1B'; interface Benefit { icon: string; description: string; } export class LaunchKit extends React.Component { private readonly _throttledScreenWidthUpdate: () => void; constructor(props: LaunchKitProps) { super(props); this.state = { screenWidth: utils.getScreenWidth(), }; this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); } public componentDidMount(): void { window.addEventListener('resize', this._throttledScreenWidthUpdate); window.scrollTo(0, 0); } public componentWillUnmount(): void { window.removeEventListener('resize', this._throttledScreenWidthUpdate); } public render(): React.ReactNode { return (
{this._renderHero()} {this._renderSection()} {this._renderCallToAction()}
); } private _renderHero(): React.ReactNode { const BENEFITS_1: Benefit[] = [ { icon: '/images/launch_kit/shared_liquidity.svg', description: this.props.translate.get(Key.TapIntoAndShare, Deco.Cap), }, { icon: '/images/launch_kit/fork.svg', description: this.props.translate.get(Key.ForkAndExtend, Deco.Cap), }, { icon: '/images/launch_kit/enable_trading.svg', description: this.props.translate.get(Key.EnableTrading, Deco.Cap), }, ]; const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const smallButtonPadding = '12px 30px 12px 30px'; const largeButtonPadding = '14px 60px 14px 60px'; const left = 'col lg-col-6 md-col-6 col-12 lg-pl2 md-pl2 sm-pl0 sm-px3 sm-center'; const flexClassName = isSmallScreen ? 'flex items-center flex-column justify-center' : 'flex items-center justify-center'; return (
{this.props.translate.get(Key.LaunchKit, Deco.CapWords)} {this.props.translate.get(Key.LaunchKitPitch, Deco.Cap)}
; {this._renderBenefits(BENEFITS_1)}
); } private _renderSection(): React.ReactNode { const BENEFITS_2: Benefit[] = [ { icon: '/images/launch_kit/secondary_market.svg', description: this.props.translate.get(Key.QuicklyLaunch, Deco.Cap), }, { icon: '/images/launch_kit/in_game_marketplace.svg', description: this.props.translate.get(Key.SeemlesslyCreate, Deco.Cap), }, { icon: '/images/launch_kit/local_market.svg', description: this.props.translate.get(Key.LocalMarket, Deco.Cap), }, ]; return (
{this.props.translate.get(Key.PerfectForDevelopers, Deco.CapWords)} {this._renderBenefits(BENEFITS_2)}
); } private _renderCallToAction(): React.ReactNode { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const smallButtonPadding = '8px 14px 8px 14px'; const largeButtonPadding = '8px 14px 8px 14px'; return ( View our comprehensive documentation to start building today.
); } private _renderBenefits(benefits: Benefit[]): React.ReactNode { return ( {_.map(benefits, benefit => { return ( {benefit.description} ); })} ); } private _updateScreenWidth(): void { const newScreenWidth = utils.getScreenWidth(); if (newScreenWidth !== this.state.screenWidth) { this.setState({ screenWidth: newScreenWidth, }); } } }