aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-15 19:20:30 +0800
committerFabio Berger <me@fabioberger.com>2018-10-15 19:20:30 +0800
commitb3a323efa1fc5d942c2f7052f585acc248394f44 (patch)
tree1855e925e125f3dfd2f5aeac12b17d164894a8b3 /packages/react-shared
parentbf9af95654503df94b5b32af74a4cbc8bee7f2ec (diff)
downloaddexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar.gz
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar.bz2
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar.lz
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar.xz
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.tar.zst
dexon-0x-contracts-b3a323efa1fc5d942c2f7052f585acc248394f44.zip
fix: Nested a tag warning in console by not rendering a tags within type definition popovers
Diffstat (limited to 'packages/react-shared')
-rw-r--r--packages/react-shared/src/components/anchor_title.tsx34
1 files changed, 20 insertions, 14 deletions
diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx
index dabdfff9b..0bdf61d44 100644
--- a/packages/react-shared/src/components/anchor_title.tsx
+++ b/packages/react-shared/src/components/anchor_title.tsx
@@ -15,6 +15,7 @@ export interface AnchorTitleProps {
id: string;
headerSize: HeaderSizes;
shouldShowAnchor: boolean;
+ isDisabled?: boolean;
}
export interface AnchorTitleState {
@@ -40,6 +41,9 @@ const styles: Styles = {
};
export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleState> {
+ public static defaultProps: Partial<AnchorTitleProps> = {
+ isDisabled: false,
+ };
constructor(props: AnchorTitleProps) {
super(props);
this.state = {
@@ -67,20 +71,22 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
<div className="inline-block" style={{ paddingRight: 4, color: colors.darkestGrey }}>
{this.props.title}
</div>
- <ScrollLink
- to={this.props.id}
- hashSpy={true}
- offset={headerSizeToScrollOffset[this.props.headerSize]}
- duration={constants.DOCS_SCROLL_DURATION_MS}
- containerId={constants.SCROLL_CONTAINER_ID}
- >
- <i
- className="zmdi zmdi-link"
- style={{ ...styles.anchor, opacity }}
- onMouseOver={this._setHoverState.bind(this, true)}
- onMouseOut={this._setHoverState.bind(this, false)}
- />
- </ScrollLink>
+ {!this.props.isDisabled && (
+ <ScrollLink
+ to={this.props.id}
+ hashSpy={true}
+ offset={headerSizeToScrollOffset[this.props.headerSize]}
+ duration={constants.DOCS_SCROLL_DURATION_MS}
+ containerId={constants.SCROLL_CONTAINER_ID}
+ >
+ <i
+ className="zmdi zmdi-link"
+ style={{ ...styles.anchor, opacity }}
+ onMouseOver={this._setHoverState.bind(this, true)}
+ onMouseOut={this._setHoverState.bind(this, false)}
+ />
+ </ScrollLink>
+ )}
</div>
);
}