mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-31 07:32:53 +00:00
fix(v2): hide mobile collapsible doc toc if no headings (#5172)
This commit is contained in:
parent
818fb3956b
commit
0851e0e5bf
|
|
@ -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…
Reference in New Issue