fix(v2): hide mobile collapsible doc toc if no headings (#5172)

This commit is contained in:
Sébastien Lorber 2021-07-15 09:51:23 +02:00 committed by GitHub
parent 818fb3956b
commit 0851e0e5bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 (
<>