diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index 4638d637994..9c0bb44b237 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -24,8 +24,10 @@ import { import { SpaceShip } from '@/components/SpaceShip'; import { LEFT_NAV_LINKS, RIGHT_NAV_LINKS } from '@/utils/globalnav'; import { LayoutProvider, LayoutHeader } from '@/components/Layout'; -import { TableOfContents } from '@/components/TableOfContents'; -import type { HeadingInterface } from '@/components/TableOfContents/TableOfContents'; +import { + TableOfContents, + type HeadingInterface +} from '@/components/TableOfContents/TableOfContents'; import { Breadcrumbs } from '@/components/Breadcrumbs'; import { debounce } from '@/utils/debounce'; import '@docsearch/css'; @@ -62,6 +64,7 @@ export const Layout = ({ useCustomTitle?: boolean; }) => { const [menuOpen, toggleMenuOpen] = useState(false); + const [tocOpen, toggleTocOpen] = useState(false); const [colorMode, setColorMode] = useState('system'); const [tocHeadings, setTocHeadings] = useState([]); const mainId = 'pageMain'; @@ -222,7 +225,9 @@ export const Layout = ({ value={{ colorMode, menuOpen, + tocOpen, toggleMenuOpen, + toggleTocOpen, handleColorModeChange }} > @@ -257,6 +262,7 @@ export const Layout = ({ currentPlatform={currentPlatform} pageType={pageType} showLastUpdatedDate={showLastUpdatedDate} + tocHeadings={tocHeadings} > } - {showTOC ? : null} + {showTOC ? ( + + ) : null}