blob: a065efc80e9808855226d5946487d06be889fa8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
import { colors } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
import DocumentTitle = require('react-document-title');
import { DocsContentTopBar } from 'ts/components/documentation/docs_content_top_bar';
import { DocsLogo } from 'ts/components/documentation/docs_logo';
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';
const THROTTLE_TIMEOUT = 100;
export interface HomeProps {
location: Location;
translate: Translate;
screenWidth: ScreenWidths;
dispatcher: Dispatcher;
}
export interface HomeState {}
export class Home extends React.Component<HomeProps, HomeState> {
private readonly _throttledScreenWidthUpdate: () => void;
constructor(props: HomeProps) {
super(props);
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 {
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
const mainContentPadding = isSmallScreen ? 0 : 50;
return (
<Container
className="flex items-center"
width="100%"
background={`linear-gradient(to right, ${colors.grey100} 0%, ${colors.grey100} 50%, ${
colors.white
} 50%, ${colors.white} 100%)`}
>
<DocumentTitle title="0x Docs Home" />
<div className="flex mx-auto">
<Container
className="sm-hide xs-hide"
width={234}
paddingLeft={22}
paddingRight={22}
paddingTop={2}
backgroundColor={colors.grey100}
height="100vh"
>
<DocsLogo height={36} containerStyle={{ paddingTop: 28 }} />
</Container>
<Container
width={isSmallScreen ? '100vw' : 716}
paddingLeft={mainContentPadding}
paddingRight={mainContentPadding}
backgroundColor={colors.white}
height="100vh"
>
<DocsContentTopBar location={this.props.location} translate={this.props.translate} />
<div>
<h1 style={{ color: '#333333', fontSize: 30 }}>Start building on 0x</h1>
</div>
</Container>
</div>
</Container>
);
}
private _updateScreenWidth(): void {
const newScreenWidth = utils.getScreenWidth();
this.props.dispatcher.updateScreenWidth(newScreenWidth);
}
}
|