diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-02 21:40:26 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-02 21:40:26 +0800 |
commit | 67c834841ea0f8fb4d8d194c0f68802f48e764ee (patch) | |
tree | 1cea9006d0b572318d1d0784f97eee8b85a413c8 /packages/website/ts/pages/wiki/wiki.tsx | |
parent | edaa0b0e34f99b0d34405eecb6aee54c1f6d7c7e (diff) | |
download | dexon-0x-contracts-67c834841ea0f8fb4d8d194c0f68802f48e764ee.tar.gz dexon-0x-contracts-67c834841ea0f8fb4d8d194c0f68802f48e764ee.tar.zst dexon-0x-contracts-67c834841ea0f8fb4d8d194c0f68802f48e764ee.zip |
Update react-markdown, properly scroll to section for wiki internal links, consolidate scrollTo logic and make external links open in new tabs
Diffstat (limited to 'packages/website/ts/pages/wiki/wiki.tsx')
-rw-r--r-- | packages/website/ts/pages/wiki/wiki.tsx | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx index 56c3be0fe..d0cbf0d3e 100644 --- a/packages/website/ts/pages/wiki/wiki.tsx +++ b/packages/website/ts/pages/wiki/wiki.tsx @@ -135,11 +135,11 @@ export class Wiki extends React.Component<WikiProps, WikiState> { }} > <div - id="documentation" + id={configs.SCROLL_CONTAINER_ID} style={{ ...mainContainersStyle, overflow: 'auto' }} className="absolute" > - <div id="0xProtocolWiki" /> + <div id={configs.SCROLL_TOP_ID} /> <div id="wiki" style={{ paddingRight: 2 }}> {this._renderWikiArticles()} </div> @@ -188,19 +188,6 @@ export class Wiki extends React.Component<WikiProps, WikiState> { </div> ); } - private _scrollToHash(): void { - const hashWithPrefix = this.props.location.hash; - let hash = hashWithPrefix.slice(1); - if (_.isEmpty(hash)) { - hash = '0xProtocolWiki'; // scroll to the top - } - - scroller.scrollTo(hash, { - duration: 0, - offset: 0, - containerId: 'documentation', - }); - } private async _fetchArticlesBySectionAsync(): Promise<void> { const endpoint = `${configs.BACKEND_BASE_URL}${WebsitePaths.Wiki}`; const response = await fetch(endpoint); @@ -225,7 +212,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { articlesBySection, }, () => { - this._scrollToHash(); + utils.scrollToHash(this.props.location.hash, configs.SCROLL_CONTAINER_ID); }, ); } |