aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-02 16:15:41 +0800
committerFabio Berger <me@fabioberger.com>2018-10-02 16:15:41 +0800
commitb79e3eaec62e073d86fdd5b83e7516da81046951 (patch)
treee2695cd0f91a4a4b60b00cdf43b56cee91163ce2 /packages/website/ts
parent94766cbe1909bb9ae80157e51050bce3dab73474 (diff)
downloaddexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar.gz
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar.bz2
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar.lz
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar.xz
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.tar.zst
dexon-sol-tools-b79e3eaec62e073d86fdd5b83e7516da81046951.zip
Simplify helper methods
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/pages/documentation/home.tsx36
1 files changed, 13 insertions, 23 deletions
diff --git a/packages/website/ts/pages/documentation/home.tsx b/packages/website/ts/pages/documentation/home.tsx
index 311470d2c..57de52de2 100644
--- a/packages/website/ts/pages/documentation/home.tsx
+++ b/packages/website/ts/pages/documentation/home.tsx
@@ -355,8 +355,8 @@ export class Home extends React.Component<HomeProps, HomeState> {
paddingTop: 35,
overflow: this.state.isHoveringSidebar ? 'auto' : 'hidden',
}}
- onMouseEnter={this._onSidebarHover.bind(this)}
- onMouseLeave={this._onSidebarHoverOff.bind(this)}
+ onMouseEnter={this._onSidebarHover.bind(this, true)}
+ onMouseLeave={this._onSidebarHover.bind(this, false)}
>
<NestedSidebarMenu
topLevelMenu={topLevelMenu}
@@ -390,9 +390,9 @@ export class Home extends React.Component<HomeProps, HomeState> {
: mainContentPadding,
overflow: this.state.isHoveringMainContent ? 'auto' : 'hidden',
}}
- onMouseEnter={this._onMainContentHover.bind(this)}
- onMouseOver={this._onMainContentHover.bind(this)}
- onMouseLeave={this._onMainContentHoverOff.bind(this)}
+ onMouseEnter={this._onMainContentHover.bind(this, true)}
+ onMouseOver={this._onMainContentHover.bind(this, true)}
+ onMouseLeave={this._onMainContentHover.bind(this, false)}
>
<div>
{this._renderSectionTitle(this.props.translate.get(Key.StartBuildOn0x, Deco.Cap))}
@@ -512,30 +512,20 @@ export class Home extends React.Component<HomeProps, HomeState> {
</Text>
);
}
- private _updateScreenWidth(): void {
- const newScreenWidth = utils.getScreenWidth();
- this.props.dispatcher.updateScreenWidth(newScreenWidth);
- }
- private _onSidebarHover(_event: React.FormEvent<HTMLInputElement>): void {
- this.setState({
- isHoveringSidebar: true,
- });
- }
- private _onSidebarHoverOff(): void {
+ private _onSidebarHover(_event: React.FormEvent<HTMLInputElement>, isHovering: boolean): void {
this.setState({
- isHoveringSidebar: false,
+ isHoveringSidebar: isHovering,
});
}
- private _onMainContentHover(_event: React.FormEvent<HTMLInputElement>): void {
- if (!this.state.isHoveringMainContent) {
+ private _onMainContentHover(_event: React.FormEvent<HTMLInputElement>, isHovering: boolean): void {
+ if (isHovering !== this.state.isHoveringMainContent) {
this.setState({
- isHoveringMainContent: true,
+ isHoveringMainContent: isHovering,
});
}
}
- private _onMainContentHoverOff(): void {
- this.setState({
- isHoveringMainContent: false,
- });
+ private _updateScreenWidth(): void {
+ const newScreenWidth = utils.getScreenWidth();
+ this.props.dispatcher.updateScreenWidth(newScreenWidth);
}
} // tslint:disable:max-file-line-count