@@ -7,17 +7,18 @@ import { loadCSS } from 'fg-loadcss/src/loadCSS';
77import NextHead from 'next/head' ;
88import PropTypes from 'prop-types' ;
99import { useRouter } from 'next/router' ;
10+ import { LicenseInfo } from '@mui/x-license' ;
1011import { ponyfillGlobal } from '@mui/utils' ;
1112import PageContext from 'docs/src/modules/components/PageContext' ;
1213import GoogleAnalytics from 'docs/src/modules/components/GoogleAnalytics' ;
14+ import { CodeCopyProvider } from '@mui/docs/CodeCopy' ;
1315import { ThemeProvider } from 'docs/src/modules/components/ThemeContext' ;
1416import { CodeVariantProvider } from 'docs/src/modules/utils/codeVariant' ;
15- import { CodeCopyProvider } from 'docs/src/modules/utils/CodeCopy ' ;
17+ import { CodeStylingProvider } from 'docs/src/modules/utils/codeStylingSolution ' ;
1618import DocsStyledEngineProvider from 'docs/src/modules/utils/StyledEngineProvider' ;
17- import { pathnameToLanguage } from 'docs/src/modules/utils/helpers' ;
1819import createEmotionCache from 'docs/src/createEmotionCache' ;
1920import findActivePage from 'docs/src/modules/utils/findActivePage' ;
20- import { LicenseInfo } from '@mui/x-license ' ;
21+ import { pathnameToLanguage } from 'docs/src/modules/utils/helpers ' ;
2122import getProductInfoFromUrl from 'docs/src/modules/utils/getProductInfoFromUrl' ;
2223import { DocsProvider } from '@mui/docs/DocsProvider' ;
2324import { mapTranslations } from '@mui/docs/i18n' ;
@@ -173,7 +174,6 @@ Tip: you can access the documentation \`theme\` object directly in the console.
173174 'font-family:monospace;color:#1976d2;font-size:12px;' ,
174175 ) ;
175176}
176-
177177function AppWrapper ( props ) {
178178 const { children, emotionCache, pageProps } = props ;
179179
@@ -202,13 +202,6 @@ function AppWrapper(props) {
202202 }
203203 } , [ ] ) ;
204204
205- let fonts = [ ] ;
206- if ( pathnameToLanguage ( router . asPath ) . canonicalAs . match ( / o n e p i r a t e / ) ) {
207- fonts = [
208- 'https://fonts.googleapis.com/css?family=Roboto+Condensed:700|Work+Sans:300,400&display=swap' ,
209- ] ;
210- }
211-
212205 const pageContextValue = React . useMemo ( ( ) => {
213206 const { activePage, activePageParents } = findActivePage ( pages , router . pathname ) ;
214207 const languagePrefix = pageProps . userLanguage === 'en' ? '' : `/${ pageProps . userLanguage } ` ;
@@ -299,13 +292,21 @@ function AppWrapper(props) {
299292 } ;
300293 } , [ productId , productCategoryId , pageProps . userLanguage , router . pathname ] ) ;
301294
295+ let fonts = [ ] ;
296+ if ( pathnameToLanguage ( router . asPath ) . canonicalAs . match ( / o n e p i r a t e / ) ) {
297+ fonts = [
298+ 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@700&family=Work+Sans:wght@300;400&display=swap' ,
299+ ] ;
300+ }
301+
302302 // Replicate change reverted in https://github.com/mui/material-ui/pull/35969/files#r1089572951
303303 // Fixes playground styles in dark mode.
304304 const ThemeWrapper = router . pathname . startsWith ( '/playground' ) ? React . Fragment : ThemeProvider ;
305305
306306 return (
307307 < React . Fragment >
308308 < NextHead >
309+ < meta name = "viewport" content = "initial-scale=1, width=device-width" />
309310 { fonts . map ( ( font ) => (
310311 < link rel = "stylesheet" href = { font } key = { font } />
311312 ) ) }
@@ -318,16 +319,18 @@ function AppWrapper(props) {
318319 translations = { pageProps . translations }
319320 >
320321 < CodeCopyProvider >
321- < CodeVariantProvider >
322- < PageContext . Provider value = { pageContextValue } >
323- < ThemeWrapper >
324- < DocsStyledEngineProvider cacheLtr = { emotionCache } >
325- { children }
326- < GoogleAnalytics />
327- </ DocsStyledEngineProvider >
328- </ ThemeWrapper >
329- </ PageContext . Provider >
330- </ CodeVariantProvider >
322+ < CodeStylingProvider >
323+ < CodeVariantProvider >
324+ < PageContext . Provider value = { pageContextValue } >
325+ < ThemeWrapper >
326+ < DocsStyledEngineProvider cacheLtr = { emotionCache } >
327+ { children }
328+ < GoogleAnalytics />
329+ </ DocsStyledEngineProvider >
330+ </ ThemeWrapper >
331+ </ PageContext . Provider >
332+ </ CodeVariantProvider >
333+ </ CodeStylingProvider >
331334 </ CodeCopyProvider >
332335 </ DocsProvider >
333336 </ React . Fragment >
@@ -343,9 +346,11 @@ AppWrapper.propTypes = {
343346export default function MyApp ( props ) {
344347 const { Component, emotionCache = clientSideEmotionCache , pageProps } = props ;
345348
349+ const getLayout = Component . getLayout ?? ( ( page ) => page ) ;
350+
346351 return (
347352 < AppWrapper emotionCache = { emotionCache } pageProps = { pageProps } >
348- < Component { ...pageProps } />
353+ { getLayout ( < Component { ...pageProps } /> ) }
349354 </ AppWrapper >
350355 ) ;
351356}
@@ -377,6 +382,7 @@ MyApp.getInitialProps = async ({ ctx, Component }) => {
377382
378383// Track fraction of actual events to prevent exceeding event quota.
379384// Filter sessions instead of individual events so that we can track multiple metrics per device.
385+ // See https://github.com/GoogleChromeLabs/web-vitals-report to use this data
380386const disableWebVitalsReporting = Math . random ( ) > 0.0001 ;
381387export function reportWebVitals ( { id, name, label, delta, value } ) {
382388 if ( disableWebVitalsReporting ) {
0 commit comments