diff --git a/docs/pages/_app.js b/docs/pages/_app.js index 27343682d9161b..c03252f604599c 100644 --- a/docs/pages/_app.js +++ b/docs/pages/_app.js @@ -31,42 +31,9 @@ import SvgMuiLogomark, { } from 'docs/src/icons/SvgMuiLogomark'; import './global.css'; import '../public/static/components-gallery/base-theme.css'; -import { Inter, Roboto } from 'next/font/google'; -import localFont from 'next/font/local'; 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'], -}); - -const generalSans = localFont({ - declarations: [{ prop: 'font-family', value: 'General Sans' }], - src: [ - { path: '../public/static/fonts/GeneralSans-Regular.woff2', weight: '400', style: 'normal' }, - { path: '../public/static/fonts/GeneralSans-Medium.woff2', weight: '500', style: 'normal' }, - { path: '../public/static/fonts/GeneralSans-Semibold.woff2', weight: '600', style: 'normal' }, - { path: '../public/static/fonts/GeneralSans-Bold.woff2', weight: '700', style: 'normal' }, - ], -}); - -const ibmPlexSans = localFont({ - declarations: [{ prop: 'font-family', value: 'IBM Plex Sans' }], - src: [ - { path: '../public/static/fonts/IBMPlexSans-Regular.woff2', weight: '400', style: 'normal' }, - { path: '../public/static/fonts/IBMPlexSans-Medium.woff2', weight: '500', style: 'normal' }, - { path: '../public/static/fonts/IBMPlexSans-SemiBold.woff2', weight: '600', style: 'normal' }, - { path: '../public/static/fonts/IBMPlexSans-Bold.woff2', weight: '700', style: 'normal' }, - ], -}); - -export const fontClasses = `${inter.className} ${roboto.className} ${generalSans.className} ${ibmPlexSans.className}`; +export { fontClasses } from '@mui/docs/nextFonts'; // Remove the license warning from demonstration purposes LicenseInfo.setLicenseKey(process.env.NEXT_PUBLIC_MUI_LICENSE); diff --git a/packages/mui-docs/package.json b/packages/mui-docs/package.json index 8b34ddfe073e71..dfc463a38ebcac 100644 --- a/packages/mui-docs/package.json +++ b/packages/mui-docs/package.json @@ -21,7 +21,7 @@ }, "homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-docs", "scripts": { - "build": "code-infra build --copy \"src/translations/translations.json\" --copy \"src/translations/translations.json:esm\"", + "build": "code-infra build --copy \"src/translations/translations.json\" --copy \"src/translations/translations.json:esm\" --copy \"src/nextFonts/fonts\" --copy \"src/nextFonts/fonts:esm\"", "release": "pnpm build && pnpm publish", "test": "exit 0", "typescript": "tsc -p tsconfig.json" diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.ttf b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.ttf new file mode 100644 index 00000000000000..61a5df96586571 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.woff2 b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.woff2 new file mode 100644 index 00000000000000..65b0b4aa13739b Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Bold.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.ttf b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.ttf new file mode 100644 index 00000000000000..e072c8373a01e0 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.woff2 b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.woff2 new file mode 100644 index 00000000000000..c90195fa2b10ec Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Medium.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.ttf b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.ttf new file mode 100644 index 00000000000000..d970a994ebcb1c Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.woff2 b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.woff2 new file mode 100644 index 00000000000000..2bc4672a793a46 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Regular.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 new file mode 100644 index 00000000000000..37d37d3b412e84 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.ttf b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.ttf new file mode 100644 index 00000000000000..916b8091adce72 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.woff2 b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.woff2 new file mode 100644 index 00000000000000..b17a037e3ccd19 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/GeneralSans-Semibold.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.ttf b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.ttf new file mode 100644 index 00000000000000..e324b09f94527d Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff new file mode 100644 index 00000000000000..a220c9e1aac0bd Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff2 b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff2 new file mode 100644 index 00000000000000..f86a4f4e324600 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Bold.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.ttf b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.ttf new file mode 100644 index 00000000000000..b278201ec77110 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff new file mode 100644 index 00000000000000..082c6012bf101f Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff2 b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff2 new file mode 100644 index 00000000000000..e08b27b831e7f4 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Medium.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 new file mode 100644 index 00000000000000..beb09d432f484f Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.ttf b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.ttf new file mode 100644 index 00000000000000..3b16bfd91ffd89 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff new file mode 100644 index 00000000000000..79bdeab7920df4 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff2 b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff2 new file mode 100644 index 00000000000000..a6aad7cdd5e3a3 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-Regular.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.ttf b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.ttf new file mode 100644 index 00000000000000..89aa8e82c31293 Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.ttf differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff new file mode 100644 index 00000000000000..fa272e45373b6e Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff differ diff --git a/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 new file mode 100644 index 00000000000000..535fcfa6941eaa Binary files /dev/null and b/packages/mui-docs/src/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 differ diff --git a/packages/mui-docs/src/nextFonts/index.ts b/packages/mui-docs/src/nextFonts/index.ts new file mode 100644 index 00000000000000..989fff2a814f82 --- /dev/null +++ b/packages/mui-docs/src/nextFonts/index.ts @@ -0,0 +1,37 @@ +import { Inter, Roboto } from 'next/font/google'; +import localFont from 'next/font/local'; + +export const inter = Inter({ + weight: ['300', '400', '500', '600', '700'], + subsets: ['latin'], +}); + +export const roboto = Roboto({ + weight: ['300', '400', '500', '700'], + style: ['normal', 'italic'], + subsets: ['latin'], +}); + +export const generalSans = localFont({ + declarations: [{ prop: 'font-family', value: 'General Sans' }], + src: [ + { path: './fonts/GeneralSans-Regular.woff2', weight: '400', style: 'normal' }, + { path: './fonts/GeneralSans-Medium.woff2', weight: '500', style: 'normal' }, + { path: './fonts/GeneralSans-Semibold.woff2', weight: '600', style: 'normal' }, + { path: './fonts/GeneralSans-Bold.woff2', weight: '700', style: 'normal' }, + ], +}); + +export const ibmPlexSans = localFont({ + declarations: [{ prop: 'font-family', value: 'IBM Plex Sans' }], + src: [ + { path: './fonts/IBMPlexSans-Regular.woff2', weight: '400', style: 'normal' }, + { path: './fonts/IBMPlexSans-Medium.woff2', weight: '500', style: 'normal' }, + { path: './fonts/IBMPlexSans-SemiBold.woff2', weight: '600', style: 'normal' }, + { path: './fonts/IBMPlexSans-Bold.woff2', weight: '700', style: 'normal' }, + ], +}); + +export const fonts = [inter, roboto, generalSans, ibmPlexSans]; + +export const fontClasses = fonts.map((font) => font.className).join(' ');