Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Simplify anchor link #31419

Merged
merged 1 commit into from
Mar 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docs/src/modules/components/AppTableOfContents.js
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import { styled } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import NoSsr from '@mui/material/NoSsr';
import Link from 'docs/src/modules/components/Link';
import PageContext from 'docs/src/modules/components/PageContext';
import { useTranslate } from 'docs/src/modules/utils/i18n';
import TableOfContentsBanner from 'docs/src/components/banner/TableOfContentsBanner';

@@ -119,8 +118,6 @@ export default function AppTableOfContents(props) {
const t = useTranslate();

const items = React.useMemo(() => flatten(toc), [toc]);

const { activePage } = React.useContext(PageContext);
const [activeState, setActiveState] = React.useState(null);
const clickedRef = React.useRef(false);
const unsetClickedRef = React.useRef(null);
@@ -199,7 +196,7 @@ export default function AppTableOfContents(props) {
const itemLink = (item, secondary) => (
<NavItem
display="block"
href={`${activePage?.linkProps?.linkAs ?? activePage?.pathname}#${item.hash}`}
href={`#${item.hash}`}
underline="none"
onClick={handleClick(item.hash)}
active={activeState === item.hash}