@@ -9,6 +9,7 @@ import JoyInitColorSchemeScript from '@mui/joy/InitColorSchemeScript';
99import { pathnameToLanguage } from 'docs/src/modules/utils/helpers' ;
1010import createEmotionCache from 'docs/src/createEmotionCache' ;
1111import { getMetaThemeColor } from '@mui/docs/branding' ;
12+ import { fontClasses } from './_app' ;
1213
1314const PRODUCTION_GA =
1415 process . env . DEPLOY_ENV === 'production' || process . env . DEPLOY_ENV === 'staging' ;
@@ -49,48 +50,6 @@ export default class MyDocument extends Document {
4950 } ${ canonicalAsServer } `}
5051 />
5152 < link rel = "alternate" href = { `https://mui.com${ canonicalAsServer } ` } hrefLang = "x-default" />
52- { /*
53- Preconnect allows the browser to setup early connections before an HTTP request
54- is actually sent to the server.
55- This includes DNS lookups, TLS negotiations, TCP handshakes.
56- */ }
57- < link href = "https://fonts.gstatic.com" rel = "preconnect" crossOrigin = "anonymous" />
58- < link rel = "preconnect" href = "https://fonts.googleapis.com" />
59- < link
60- href = "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700& family = Roboto :ital , wght @0 , 300 ; 0 , 400 ; 0 , 500 ; 0 , 700 ; 1 , 400 & display = swap "
61- rel = "stylesheet"
62- />
63- { /* ========== Font preload (prevent font flash) ============= */ }
64- < link
65- rel = "preload"
66- // optimized for english characters (40kb -> 6kb)
67- href = "/static/fonts/GeneralSans-Semibold-subset.woff2"
68- as = "font"
69- type = "font/woff2"
70- crossOrigin = "anonymous"
71- />
72- < style
73- // the above <link> does not work in mobile device, this inline <style> fixes it without blocking resources
74- // eslint-disable-next-line react/no-danger
75- dangerouslySetInnerHTML = { {
76- __html : `@font-face{font-family:'General Sans';font-style:normal;font-weight:600;font-display:swap;src:url('/static/fonts/GeneralSans-Semibold-subset.woff2') format('woff2');}` ,
77- } }
78- />
79- < link
80- rel = "preload"
81- // optimized for english characters (40kb -> 6kb)
82- href = "/static/fonts/IBMPlexSans-Regular-subset.woff2"
83- as = "font"
84- type = "font/woff2"
85- crossOrigin = "anonymous"
86- />
87- < style
88- // the above <link> does not work in mobile device, this inline <style> fixes it without blocking resources
89- // eslint-disable-next-line react/no-danger
90- dangerouslySetInnerHTML = { {
91- __html : `@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:400;font-display:swap;src:url('/static/fonts/IBMPlexSans-Regular-subset.woff2') format('woff2');}` ,
92- } }
93- />
9453 { /* =========================================================== */ }
9554 < style
9655 // Loads General Sans: Regular (400), Medium (500), SemiBold (600), Bold (700)
@@ -166,7 +125,7 @@ export default class MyDocument extends Document {
166125 } }
167126 />
168127 </ Head >
169- < body >
128+ < body className = { fontClasses } >
170129 < MuiInitColorSchemeScript defaultMode = "system" />
171130 < JoyInitColorSchemeScript defaultMode = "system" />
172131 < Main />
0 commit comments