diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-03 12:36:26 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-03 12:36:26 +0800 |
commit | fdaf9f0bfc24a93933fb492d727d970d8c82d8ee (patch) | |
tree | c5505ca7747908c82cf4edd0a0168b148344082e /packages | |
parent | 0afe45b3a830bfefc4f9b51823891b99be5261fa (diff) | |
download | dexon-0x-contracts-fdaf9f0bfc24a93933fb492d727d970d8c82d8ee.tar.gz dexon-0x-contracts-fdaf9f0bfc24a93933fb492d727d970d8c82d8ee.tar.zst dexon-0x-contracts-fdaf9f0bfc24a93933fb492d727d970d8c82d8ee.zip |
Fix comment and use named variable in conditional
Diffstat (limited to 'packages')
-rw-r--r-- | packages/website/ts/pages/shared/markdown_link_block.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/website/ts/pages/shared/markdown_link_block.tsx b/packages/website/ts/pages/shared/markdown_link_block.tsx index ed78e4e53..e4553c87f 100644 --- a/packages/website/ts/pages/shared/markdown_link_block.tsx +++ b/packages/website/ts/pages/shared/markdown_link_block.tsx @@ -10,13 +10,14 @@ interface MarkdownLinkBlockProps { interface MarkdownLinkBlockState {} export class MarkdownLinkBlock extends React.Component<MarkdownLinkBlockProps, MarkdownLinkBlockState> { - // Re-rendering a linkBlock causes any use selection to become de-selected making the link unclickable. + // Re-rendering a linkBlock causes it to remain unclickable. // We therefore noop re-renders on this component if it's props haven't changed. public shouldComponentUpdate(nextProps: MarkdownLinkBlockProps, nextState: MarkdownLinkBlockState) { return nextProps.href !== this.props.href; } public render() { const href = this.props.href; + const isLinkToSection = _.startsWith(href, '#'); // If protocol is http or https, we can open in a new tab, otherwise don't for security reasons if (_.startsWith(href, 'http') || _.startsWith(href, 'https')) { return ( @@ -24,7 +25,7 @@ export class MarkdownLinkBlock extends React.Component<MarkdownLinkBlockProps, M {this.props.children} </a> ); - } else if (_.startsWith(href, '#')) { + } else if (isLinkToSection) { return ( <a style={{ cursor: 'pointer', textDecoration: 'underline' }} |