mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-07-16 16:41:01 +02:00
style: prettier
This commit is contained in:
parent
c933b93db2
commit
8c3dad15e0
@ -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 === "") {
|
||||
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) {
|
||||
@ -63,8 +68,8 @@ export function googleFontHref(theme: Theme) {
|
||||
}
|
||||
|
||||
function renderFonts(fonts: string | string[]) {
|
||||
if(Array.isArray(fonts)) {
|
||||
return fonts.map(s => `"${s}"`).join(", ")
|
||||
if (Array.isArray(fonts)) {
|
||||
return fonts.map((s) => `"${s}"`).join(", ")
|
||||
} else {
|
||||
return `"${fonts}"`
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user