Skip to content

Commit

Permalink
fix(v2): hide mobile collapsible doc toc if no headings (#5172)
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber authored Jul 15, 2021
1 parent 818fb39 commit 0851e0e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/docusaurus-theme-classic/src/theme/DocItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ function DocItem(props: Props): JSX.Element {

const windowSize = useWindowSize();

const canRenderTOC =
!hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;

const renderTocMobile =
!hideTableOfContents &&
DocContent.toc &&
(windowSize === 'mobile' || windowSize === 'ssr');
canRenderTOC && (windowSize === 'mobile' || windowSize === 'ssr');

const renderTocDesktop =
!hideTableOfContents &&
DocContent.toc &&
(windowSize === 'desktop' || windowSize === 'ssr');
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');

return (
<>
Expand Down

0 comments on commit 0851e0e

Please sign in to comment.