@@ -5,9 +5,9 @@ import { Ad, AdGuest } from '@mui/docs/Ad';
5
5
import RichMarkdownElement from 'docs/src/modules/components/RichMarkdownElement' ;
6
6
import AppLayoutDocs from 'docs/src/modules/components/AppLayoutDocs' ;
7
7
import { useUserLanguage } from '@mui/docs/i18n' ;
8
- import { useRouter } from 'next/router ' ;
9
- import { DemoPageThemeProvider } from 'docs/src/theming' ;
10
- import GlobalStyles from '@mui/material/GlobalStyles ';
8
+ import useScopedDemo from '../utils/useScopedDemo ' ;
9
+
10
+ const isBrowser = typeof window !== 'undefined ';
11
11
12
12
export default function MarkdownDocs ( props ) {
13
13
const {
@@ -23,37 +23,27 @@ export default function MarkdownDocs(props) {
23
23
const userLanguage = useUserLanguage ( ) ;
24
24
const localizedDoc = docs [ userLanguage ] || docs . en ;
25
25
26
- const router = useRouter ( ) ;
27
- const isBrowser = typeof window !== 'undefined' ;
28
- let scopedDemo = router . query . scopedDemo ;
29
- if ( scopedDemo === undefined && isBrowser ) {
30
- scopedDemo = new URLSearchParams ( window . location . search ) . get ( 'scopedDemo' ) ;
31
- }
26
+ const scopedDemo = useScopedDemo ( ) ;
32
27
33
28
if ( scopedDemo ) {
34
29
if ( isBrowser ) {
35
30
document . body . style . visibility = 'initial' ;
36
31
}
37
- const canonicalAs = router . asPath || '' ;
38
- const isJoy = canonicalAs . startsWith ( '/joy-ui/' ) ;
39
32
return (
40
- < DemoPageThemeProvider hasJoy = { isJoy } >
41
- < GlobalStyles />
42
- < div style = { { width : '100%' , height : '100vh' , padding : '4px' } } >
43
- < RichMarkdownElement
44
- demoComponents = { demoComponents }
45
- demos = { demos }
46
- disableAd = { disableAd }
47
- localizedDoc = { localizedDoc }
48
- srcComponents = { srcComponents }
49
- renderedMarkdownOrDemo = { {
50
- demo : scopedDemo ,
51
- hideToolbar : true ,
52
- bg : false ,
53
- } }
54
- />
55
- </ div >
56
- </ DemoPageThemeProvider >
33
+ < div style = { { width : '100%' , height : '100vh' , padding : '4px' } } >
34
+ < RichMarkdownElement
35
+ demoComponents = { demoComponents }
36
+ demos = { demos }
37
+ disableAd = { disableAd }
38
+ localizedDoc = { localizedDoc }
39
+ srcComponents = { srcComponents }
40
+ renderedMarkdownOrDemo = { {
41
+ demo : scopedDemo ,
42
+ hideToolbar : true ,
43
+ bg : false ,
44
+ } }
45
+ />
46
+ </ div >
57
47
) ;
58
48
}
59
49
0 commit comments