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"
|
* e.g. "ital,wght@0,400;1,200"
|
||||||
*/
|
*/
|
||||||
features: string,
|
features: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Theme {
|
export interface Theme {
|
||||||
fonts?: Record<string, FontInfo>,
|
fonts?: Record<string, FontInfo>
|
||||||
typography: {
|
typography: {
|
||||||
header: string | string[]
|
header: string | string[]
|
||||||
body: 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) {
|
function makeFamilySection(theme: Theme, family: string | string[], defaultFeatures: string) {
|
||||||
const families = Array.isArray(family) ? family : [family]
|
const families = Array.isArray(family) ? family : [family]
|
||||||
return "family=" + families.map(f => {
|
return (
|
||||||
const features = theme.fonts?.[f]?.features ?? defaultFeatures
|
"family=" +
|
||||||
if(features === "") {
|
families
|
||||||
return `${f}:wght@400` // matches unplugin-fonts; should be a sane default
|
.map((f) => {
|
||||||
} else {
|
const features = theme.fonts?.[f]?.features ?? defaultFeatures
|
||||||
return `${f}:${features}`
|
if (features === "") {
|
||||||
}
|
return `${f}:wght@400` // matches unplugin-fonts; should be a sane default
|
||||||
}).join("&family=")
|
} else {
|
||||||
|
return `${f}:${features}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.join("&family=")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function googleFontHref(theme: Theme) {
|
export function googleFontHref(theme: Theme) {
|
||||||
@ -63,8 +68,8 @@ export function googleFontHref(theme: Theme) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderFonts(fonts: string | string[]) {
|
function renderFonts(fonts: string | string[]) {
|
||||||
if(Array.isArray(fonts)) {
|
if (Array.isArray(fonts)) {
|
||||||
return fonts.map(s => `"${s}"`).join(", ")
|
return fonts.map((s) => `"${s}"`).join(", ")
|
||||||
} else {
|
} else {
|
||||||
return `"${fonts}"`
|
return `"${fonts}"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user