aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-01 23:33:28 +0800
committerFabio Berger <me@fabioberger.com>2018-08-01 23:33:28 +0800
commit11869122b4fe00c834347f9911985d7b2572bc9b (patch)
tree23d03a04d17e0f15bad126945aa8c01d5becb923 /packages/react-shared
parent9b24459108c826843cfddb377e66327e11b1d85b (diff)
downloaddexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar.gz
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar.bz2
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar.lz
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar.xz
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.tar.zst
dexon-sol-tools-11869122b4fe00c834347f9911985d7b2572bc9b.zip
Update React-scroll, getting rid of the need to manually set the url hash
Diffstat (limited to 'packages/react-shared')
-rw-r--r--packages/react-shared/package.json4
-rw-r--r--packages/react-shared/src/components/anchor_title.tsx2
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx17
3 files changed, 6 insertions, 17 deletions
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index 6b4501e83..9f4cfd624 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -39,7 +39,7 @@
"@types/node": "^8.0.53",
"@types/react": "*",
"@types/react-dom": "*",
- "@types/react-scroll": "0.0.31",
+ "@types/react-scroll": "1.5.3",
"basscss": "^8.0.3",
"is-mobile": "^0.2.2",
"lodash": "^4.17.4",
@@ -48,7 +48,7 @@
"react-dom": "15.6.1",
"react-highlight": "0xproject/react-highlight",
"react-markdown": "^3.2.2",
- "react-scroll": "^1.5.2",
+ "react-scroll": "^1.7.10",
"react-tap-event-plugin": "^2.0.1"
},
"publishConfig": {
diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx
index 473b994bf..451ba1729 100644
--- a/packages/react-shared/src/components/anchor_title.tsx
+++ b/packages/react-shared/src/components/anchor_title.tsx
@@ -69,13 +69,13 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
</div>
<ScrollLink
to={this.props.id}
+ hashSpy={true}
offset={headerSizeToScrollOffset[this.props.headerSize]}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
<i
className="zmdi zmdi-link"
- onClick={utils.setUrlHash.bind(utils, this.props.id)}
style={{ ...styles.anchor, opacity }}
onMouseOver={this._setHoverState.bind(this, true)}
onMouseOut={this._setHoverState.bind(this, false)}
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index aa00d5985..10bcb7d8c 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -94,14 +94,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
key={`menuItem-${menuItemName}`}
to={id}
offset={-10}
+ hashSpy={true}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
- <MenuItem
- onTouchTap={this._onMenuItemClick.bind(this, finalMenuItemName)}
- style={menuItemStyles}
- innerDivStyle={menuItemInnerDivStyles}
- >
+ <MenuItem style={menuItemStyles} innerDivStyle={menuItemInnerDivStyles}>
<span style={{ textTransform: 'capitalize' }}>{finalMenuItemName}</span>
</MenuItem>
</ScrollLink>
@@ -128,12 +125,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
<ScrollLink
to={id}
offset={0}
+ hashSpy={true}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
- onTouchTap={this._onMenuItemClick.bind(this, name)}
>
<MenuItem
- onTouchTap={this._onMenuItemClick.bind(this, name)}
style={{ minHeight: 35 }}
innerDivStyle={{
paddingLeft: 16,
@@ -150,11 +146,4 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
</ul>
);
}
- private _onMenuItemClick(name: string): void {
- const id = utils.getIdFromName(name);
- utils.setUrlHash(id);
- if (!_.isUndefined(this.props.onMenuItemClick)) {
- this.props.onMenuItemClick();
- }
- }
}