Replace remaining scroll-links with Link component
This commit is contained in:
parent
2d43f312c8
commit
0d201173ef
@ -3,7 +3,6 @@ import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0x/types';
|
|||||||
import { errorUtils } from '@0x/utils';
|
import { errorUtils } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link as ScrollLink } from 'react-scroll';
|
|
||||||
import * as ReactTooltip from 'react-tooltip';
|
import * as ReactTooltip from 'react-tooltip';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
@ -224,13 +223,7 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
|
|||||||
{sharedUtils.isUserOnMobile() || props.isInPopover || isExportedClassReference ? (
|
{sharedUtils.isUserOnMobile() || props.isInPopover || isExportedClassReference ? (
|
||||||
<span style={{ color: colors.lightBlueA700, cursor: 'pointer' }}>{typeName}</span>
|
<span style={{ color: colors.lightBlueA700, cursor: 'pointer' }}>{typeName}</span>
|
||||||
) : (
|
) : (
|
||||||
<ScrollLink
|
<Link to={typeDefinitionAnchorId}>
|
||||||
to={typeDefinitionAnchorId}
|
|
||||||
offset={0}
|
|
||||||
hashSpy={true}
|
|
||||||
duration={sharedConstants.DOCS_SCROLL_DURATION_MS}
|
|
||||||
containerId={sharedConstants.SCROLL_CONTAINER_ID}
|
|
||||||
>
|
|
||||||
<span
|
<span
|
||||||
data-tip={true}
|
data-tip={true}
|
||||||
data-for={id}
|
data-for={id}
|
||||||
@ -252,7 +245,7 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
|
|||||||
/>
|
/>
|
||||||
</ReactTooltip>
|
</ReactTooltip>
|
||||||
</span>
|
</span>
|
||||||
</ScrollLink>
|
</Link>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link as ScrollLink } from 'react-scroll';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { Link } from '../components/link';
|
||||||
import { HeaderSizes, Styles } from '../types';
|
import { HeaderSizes, Styles } from '../types';
|
||||||
import { colors } from '../utils/colors';
|
import { colors } from '../utils/colors';
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
|
|
||||||
const headerSizeToScrollOffset: { [headerSize: string]: number } = {
|
|
||||||
h2: -20,
|
|
||||||
h3: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface AnchorTitleProps {
|
export interface AnchorTitleProps {
|
||||||
title: string | React.ReactNode;
|
title: string | React.ReactNode;
|
||||||
@ -73,15 +67,9 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt
|
|||||||
{this.props.title}
|
{this.props.title}
|
||||||
</div>
|
</div>
|
||||||
{!this.props.isDisabled && (
|
{!this.props.isDisabled && (
|
||||||
<ScrollLink
|
<Link to={this.props.id}>
|
||||||
to={this.props.id}
|
|
||||||
hashSpy={true}
|
|
||||||
offset={headerSizeToScrollOffset[this.props.headerSize]}
|
|
||||||
duration={constants.DOCS_SCROLL_DURATION_MS}
|
|
||||||
containerId={constants.SCROLL_CONTAINER_ID}
|
|
||||||
>
|
|
||||||
<AnchorIcon className="zmdi zmdi-link" shouldShowAnchor={this.props.shouldShowAnchor} />
|
<AnchorIcon className="zmdi zmdi-link" shouldShowAnchor={this.props.shouldShowAnchor} />
|
||||||
</ScrollLink>
|
</Link>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user