Skip to content

Commit 60cee71

Browse files
committed
update docusaurus
1 parent 4bba249 commit 60cee71

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

website/src/components/TableOfContents.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,27 @@ import type { TOCItem } from '@docusaurus/mdx-loader';
22
import TOCInline from '@theme/TOCInline';
33
import { useState } from 'react';
44

5-
export const TableOfContents = ({ items }: { items: ReadonlyArray<TOCItem> }) => {
5+
type TableOfContentsProps = {
6+
items: ReadonlyArray<TOCItem>;
7+
};
8+
9+
export const TableOfContents = ({ items }: TableOfContentsProps) => {
610
const [isTocExpanded, setIsTocExpanded] = useState(false);
711

812
return (
9-
<div className="toc-inline -mt-2">
13+
<nav aria-label="Table of contents" className="toc-inline -mt-2">
1014
<button
15+
aria-controls="toc-content"
16+
aria-expanded={isTocExpanded}
1117
className="rounded-md border-none px-2 py-1 text-[11px] hover:cursor-pointer"
1218
title={`${isTocExpanded ? 'Collapse' : 'Expand'} Table of Contents`}
1319
onClick={() => setIsTocExpanded((prev) => !prev)}
1420
>
1521
{isTocExpanded ? 'Collapse' : 'Expand'}
1622
</button>
17-
<TOCInline maxHeadingLevel={isTocExpanded ? 3 : 2} minHeadingLevel={2} toc={items} />
18-
</div>
23+
<div id="toc-content">
24+
<TOCInline maxHeadingLevel={isTocExpanded ? 3 : 2} minHeadingLevel={2} toc={items} />
25+
</div>
26+
</nav>
1927
);
2028
};

0 commit comments

Comments
 (0)