From 2b49498f1ec59d1b376df7c24ddaafa55ca3a88a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 20 Nov 2025 07:27:08 +0000 Subject: [PATCH 1/6] Initial plan From be37d1168240c75eba8f23f2f2d6c56c2b789fc9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 20 Nov 2025 07:41:46 +0000 Subject: [PATCH 2/6] Migrate Google Fonts to next/font in docs Co-authored-by: Janpot <2109932+Janpot@users.noreply.github.com> --- docs/pages/_app.js | 25 ++--- docs/pages/_document.js | 3 - docs/pages/_document.tsx | 202 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 216 insertions(+), 14 deletions(-) delete mode 100644 docs/pages/_document.js create mode 100644 docs/pages/_document.tsx diff --git a/docs/pages/_app.js b/docs/pages/_app.js index d218d28ef0fba..e614513814351 100644 --- a/docs/pages/_app.js +++ b/docs/pages/_app.js @@ -18,12 +18,25 @@ import { CodeStylingProvider } from 'docs/src/modules/utils/codeStylingSolution' import DocsStyledEngineProvider from 'docs/src/modules/utils/StyledEngineProvider'; import createEmotionCache from 'docs/src/createEmotionCache'; import findActivePage from 'docs/src/modules/utils/findActivePage'; -import { pathnameToLanguage } from 'docs/src/modules/utils/helpers'; import getProductInfoFromUrl from 'docs/src/modules/utils/getProductInfoFromUrl'; import { DocsProvider } from '@mui/docs/DocsProvider'; import { mapTranslations } from '@mui/docs/i18n'; +import { Inter, Roboto } from 'next/font/google'; import * as config from '../config'; +const inter = Inter({ + weight: ['300', '400', '500', '600', '700'], + subsets: ['latin'], +}); + +const roboto = Roboto({ + weight: ['300', '400', '500', '700'], + style: ['normal', 'italic'], + subsets: ['latin'], +}); + +export const fontClasses = `${inter.className} ${roboto.className}`; + // Enable telemetry for internal purposes muiXTelemetrySettings.enableTelemetry(); // Remove the license warning from demonstration purposes @@ -299,13 +312,6 @@ function AppWrapper(props) { }; }, [productId, productCategoryId, pageProps.userLanguage, router.pathname]); - let fonts = []; - if (pathnameToLanguage(router.asPath).canonicalAs.match(/onepirate/)) { - fonts = [ - 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@700&family=Work+Sans:wght@300;400&display=swap', - ]; - } - // Replicate change reverted in https://github.com/mui/material-ui/pull/35969/files#r1089572951 // Fixes playground styles in dark mode. const ThemeWrapper = router.pathname.startsWith('/playground') ? React.Fragment : ThemeProvider; @@ -314,9 +320,6 @@ function AppWrapper(props) { - {fonts.map((font) => ( - - ))} diff --git a/docs/pages/_document.js b/docs/pages/_document.js deleted file mode 100644 index d3958152942a4..0000000000000 --- a/docs/pages/_document.js +++ /dev/null @@ -1,3 +0,0 @@ -import MyDocument from 'docs/pages/_document'; - -export default MyDocument; diff --git a/docs/pages/_document.tsx b/docs/pages/_document.tsx new file mode 100644 index 0000000000000..eb8bb131e4638 --- /dev/null +++ b/docs/pages/_document.tsx @@ -0,0 +1,202 @@ +import * as React from 'react'; +import Script from 'next/script'; +import { documentGetInitialProps } from '@mui/material-nextjs/v13-pagesRouter'; +import { ServerStyleSheet } from 'styled-components'; +import Document, { Html, Head, Main, NextScript } from 'next/document'; +import GlobalStyles from '@mui/material/GlobalStyles'; +import MuiInitColorSchemeScript from '@mui/material/InitColorSchemeScript'; +import JoyInitColorSchemeScript from '@mui/joy/InitColorSchemeScript'; +import { pathnameToLanguage } from 'docs/src/modules/utils/helpers'; +import createEmotionCache from 'docs/src/createEmotionCache'; +import { getMetaThemeColor } from '@mui/docs/branding'; +import { fontClasses } from './_app'; + +const PRODUCTION_GA = + process.env.DEPLOY_ENV === 'production' || process.env.DEPLOY_ENV === 'staging'; + +const GOOGLE_ANALYTICS_ID_V4 = PRODUCTION_GA ? 'G-5NXDQLC2ZK' : 'G-XJ83JQEK7J'; + +export default class MyDocument extends Document { + render() { + const { canonicalAsServer, userLanguage } = this.props; + + return ( + + + {/* + manifest.json provides metadata used when your web app is added to the + homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ + */} + + {/* PWA primary color */} + + + + {/* iOS Icon */} + + {/* SEO */} + + + {/* =========================================================== */} +