diff --git a/src/app/root.tsx b/src/app/root.tsx index 2e046821..1fbae010 100644 --- a/src/app/root.tsx +++ b/src/app/root.tsx @@ -29,21 +29,29 @@ export function Root({ function Head({ frontmatter }: { frontmatter: Module['frontmatter'] }) { const config = useConfig() - const { iconUrl } = config + const { font, iconUrl } = config const { title, description = config.description } = frontmatter || {} const enableTitleTemplate = config.title && config.title.toLowerCase() !== title?.toLowerCase() return ( <> + {/* Title */} {title && {title}} - {description && } + {/* Description */} + {description && ( + + + + )} + + {/* Icons */} {iconUrl && ( <> {typeof iconUrl === 'string' ? ( @@ -63,6 +71,22 @@ function Head({ frontmatter }: { frontmatter: Module['frontmatter'] }) { )} )} + + {/* Fonts */} + {font && ( + <> + {font.google && ( + + + + + + )} + + )} ) } diff --git a/src/config.ts b/src/config.ts index 809c1042..ed4a4614 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,7 +2,7 @@ import type { ReactElement } from 'react' type RequiredBy = Omit & Required> -type RequiredProperties = 'root' | 'title' | 'titleTemplate' +type RequiredProperties = 'font' | 'root' | 'title' | 'titleTemplate' export type Config = RequiredBy< { @@ -10,6 +10,12 @@ export type Config = RequiredBy< * General description for the documentation. */ description?: string + /** + * Base font face. + * + * @default { google: "Inter" } + */ + font?: Font /** * Additional tags to include in the `` tag of the page HTML. */ @@ -55,6 +61,7 @@ export type Config = RequiredBy< export type ParsedConfig = Config export function defineConfig({ + font = { google: 'Inter' }, head, root = 'docs', title = 'Docs', @@ -62,6 +69,7 @@ export function defineConfig({ ...config }: Config): ParsedConfig { return { + font, head, root, title, @@ -95,6 +103,11 @@ function parseSocials(socials: Socials): ParsedSocials { ////////////////////////////////////////////////////// // Types +export type Font = { + /** Name of the Google Font to use. */ + google?: string +} + export type IconUrl = string | { light: string; dark: string } export type LogoUrl = string | { light: string; dark: string } diff --git a/src/vite/index.html b/src/vite/index.html index 85daef0c..0d008838 100644 --- a/src/vite/index.html +++ b/src/vite/index.html @@ -3,9 +3,6 @@ - - -