mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-01 19:27:48 +02:00
fix(v2): hide mobile collapsible doc toc if no headings (#5172)
This commit is contained in:
parent
818fb3956b
commit
0851e0e5bf
1 changed files with 5 additions and 6 deletions
|
@ -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 (
|
||||
<>
|
||||
|
|
Loading…
Add table
Reference in a new issue