Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages-internal/core-docs/src/nextFonts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ import { Inter, Roboto } from 'next/font/google';
import localFont from 'next/font/local';

export const inter = Inter({
variable: '--font-inter',
weight: ['300', '400', '500', '600', '700'],
subsets: ['latin'],
preload: false,
});

export const roboto = Roboto({
variable: '--font-roboto',
weight: ['300', '400', '500', '700'],
style: ['normal', 'italic'],
subsets: ['latin'],
preload: false,
});

export const generalSans = localFont({
variable: '--font-general-sans',
declarations: [{ prop: 'font-family', value: 'General Sans' }],
src: [{ path: './fonts/GeneralSans-Semibold.woff2', weight: '600', style: 'normal' }],
});
Expand All @@ -36,6 +39,7 @@ const generalSansDeferred = localFont({
// "⌘K" badge; each preloaded file delays LCP on slow links (~0.3s per 55kB
// on Lighthouse mobile), so those two stay deferred.
export const ibmPlexSans = localFont({
variable: '--font-ibm-plex-sans',
declarations: [{ prop: 'font-family', value: 'IBM Plex Sans' }],
src: [
{ path: './fonts/IBMPlexSans-Regular.woff2', weight: '400', style: 'normal' },
Expand All @@ -61,9 +65,7 @@ export const fonts = [
roboto,
];

// The single-weight General Sans class sets font-weight: 600 on body. The import
// still registers and preloads the font, so the class is not necessary.
export const fontClasses = fonts
.filter((font) => font !== generalSans)
.map((font) => font.className)
// `className` also sets font-weight for single-file loaders, so body only gets the variables.
export const fontClasses = [ibmPlexSans, generalSans, inter, roboto]
.map((font) => font.variable)
.join(' ');
Loading