style: prettier

This commit is contained in:
Autumn 2024-10-10 18:09:33 -05:00
parent c933b93db2
commit 8c3dad15e0
No known key found for this signature in database
GPG Key ID: E1542373839B2670

View File

@ -19,11 +19,11 @@ interface FontInfo {
/**
* e.g. "ital,wght@0,400;1,200"
*/
features: string,
features: string
}
export interface Theme {
fonts?: Record<string, FontInfo>,
fonts?: Record<string, FontInfo>
typography: {
header: string | string[]
body: string | string[]
@ -42,14 +42,19 @@ const DEFAULT_MONO = "ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace"
function makeFamilySection(theme: Theme, family: string | string[], defaultFeatures: string) {
const families = Array.isArray(family) ? family : [family]
return "family=" + families.map(f => {
return (
"family=" +
families
.map((f) => {
const features = theme.fonts?.[f]?.features ?? defaultFeatures
if (features === "") {
return `${f}:wght@400` // matches unplugin-fonts; should be a sane default
} else {
return `${f}:${features}`
}
}).join("&family=")
})
.join("&family=")
)
}
export function googleFontHref(theme: Theme) {
@ -64,7 +69,7 @@ export function googleFontHref(theme: Theme) {
function renderFonts(fonts: string | string[]) {
if (Array.isArray(fonts)) {
return fonts.map(s => `"${s}"`).join(", ")
return fonts.map((s) => `"${s}"`).join(", ")
} else {
return `"${fonts}"`
}