File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
docusaurus-theme/src/theme/DocItem Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { MainHeading } from '@theme/Heading';
16
16
import clsx from 'clsx' ;
17
17
import styles from './styles.module.scss' ;
18
18
import { useActivePlugin , useVersions } from '@theme/hooks/useDocs' ;
19
+ import useWindowSize , { windowSizes } from '@theme/hooks/useWindowSize' ;
19
20
20
21
function DocItem ( props ) {
21
22
const { content : DocContent , versionMetadata } = props ;
@@ -39,6 +40,8 @@ function DocItem(props) {
39
40
lastUpdatedBy,
40
41
} = metadata ;
41
42
43
+ const windowSize = useWindowSize ( ) ;
44
+
42
45
const { pluginId } = useActivePlugin ( {
43
46
failfast : true ,
44
47
} ) ;
@@ -124,14 +127,8 @@ function DocItem(props) {
124
127
</ div >
125
128
</ div >
126
129
127
- { ! hideTableOfContents && DocContent . toc ? (
128
- < TOC
129
- toc = { DocContent . toc }
130
- editUrl = { editUrl }
131
- className = { clsx ( styles . tableOfContents ) }
132
- />
133
- ) : (
134
- demoUrl && (
130
+ { windowSize !== windowSizes . mobile &&
131
+ ( demoUrl ? (
135
132
< div
136
133
className = { clsx (
137
134
'docDemoWrapper' ,
@@ -141,8 +138,16 @@ function DocItem(props) {
141
138
>
142
139
< DocDemo url = { demoUrl } source = { demoSourceUrl } />
143
140
</ div >
144
- )
145
- ) }
141
+ ) : (
142
+ ! hideTableOfContents &&
143
+ DocContent . toc && (
144
+ < TOC
145
+ toc = { DocContent . toc }
146
+ editUrl = { editUrl }
147
+ className = { clsx ( styles . tableOfContents ) }
148
+ />
149
+ )
150
+ ) ) }
146
151
</ div >
147
152
</ >
148
153
) ;
You can’t perform that action at this time.
0 commit comments