import { Geist as HeadingFont } from 'next/font/google'; import SansFont from 'next/font/local'; import { cn } from '@kit/ui/utils'; /** * @sans * @description Define here the sans font. * By default, it uses the Inter font from Google Fonts. */ const sans = SansFont({ variable: '--font-sans', src: [ { path: '../fonts/InterDisplay-Regular.woff2', weight: '400', style: 'normal', }, { path: '../fonts/InterDisplay-Medium.woff2', weight: '500', style: 'medium', }, ], }); /** * @heading * @description Define here the heading font. */ const heading = HeadingFont({ variable: '--font-heading', subsets: ['latin'], fallback: ['system-ui', 'Helvetica Neue', 'Helvetica', 'Arial'], preload: true, weight: ['300', '400', '500', '600', '700'], }); // we export these fonts into the root layout export { sans, heading }; /** * @name getFontsClassName * @description Get the class name for the root layout. * @param theme */ export function getFontsClassName(theme?: string) { const dark = theme === 'dark'; const light = !dark; const font = [sans.variable, heading.variable].reduce( (acc, curr) => { if (acc.includes(curr)) return acc; return [...acc, curr]; }, [], ); return cn('bg-background min-h-screen antialiased', ...font, { dark, light, }); }