* chore: bump version to 2.20.1 in package.json and refactor layout and form components - Incremented application version from 2.20.0 to 2.20.1 in package.json. - Refactored RootLayout to optimize asynchronous calls and introduced getRootClassName function for better class management. - Updated font handling in getFontsClassName function to streamline class generation. - Enhanced various authentication form components by replacing Input with EmailInput and PasswordInput for improved consistency and usability. - Adjusted layout styles in AuthLayoutShell and other components for better responsiveness. * fix: improve content rendering fallback logic in ContentRenderer component - Enhanced the ContentRenderer function to explicitly check for the presence of a renderer before returning content. - Added a fallback mechanism to return raw content as React nodes when no renderer is found, improving robustness and user experience.
50 lines
1.0 KiB
TypeScript
50 lines
1.0 KiB
TypeScript
import { Inter as SansFont } from 'next/font/google';
|
|
|
|
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({
|
|
subsets: ['latin'],
|
|
variable: '--font-sans',
|
|
fallback: ['system-ui', 'Helvetica Neue', 'Helvetica', 'Arial'],
|
|
preload: true,
|
|
weight: ['300', '400', '500', '600', '700'],
|
|
});
|
|
|
|
/**
|
|
* @heading
|
|
* @description Define here the heading font.
|
|
*/
|
|
const heading = sans;
|
|
|
|
// 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<string[]>(
|
|
(acc, curr) => {
|
|
if (acc.includes(curr)) return acc;
|
|
|
|
return [...acc, curr];
|
|
},
|
|
[],
|
|
);
|
|
|
|
return cn(...font, {
|
|
dark,
|
|
light,
|
|
});
|
|
}
|