download font integration

This commit is contained in:
Julien Calixte
2024-04-06 14:11:01 +02:00
parent 809b376430
commit 8090f838be
3 changed files with 5 additions and 24 deletions

View File

@@ -2,14 +2,7 @@ import { DataType } from '@/data/DataType.enum'
import { Model } from '@/data/models/Model'
export interface UserSettings extends Model<DataType.UserSettings> {
fontFamily?:
| 'Courgette'
| 'IBM Plex Serif'
| 'Kiwi Maru'
| 'Maven Pro'
| 'Noto Sans KR'
| 'Tajawal'
| 'Domine'
fontFamily?: string
mode?: 'light' | 'dark'
backlink?: boolean
}

View File

@@ -1,8 +1,9 @@
import { watchEffect } from 'vue'
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { downloadGoogleFont } from '@/utils/downloadGoogleFont'
const DEFAULT_FONT_POLICY = "'Courier Prime', monospace"
const DEFAULT_FONT_POLICY = 'Courier Prime, monospace'
const LIGHT_FONT_COLOR = '#4a4a4a'
const LIGHT_BACKGROUND = '#ffffff'
@@ -22,7 +23,7 @@ export const useUserSettings = () => {
const mode = store.userSettings?.mode
const root = document.documentElement
root.style.setProperty('--font-family', fontFamily ?? DEFAULT_FONT_POLICY)
downloadGoogleFont(fontFamily || DEFAULT_FONT_POLICY)
switch (mode) {
case 'dark':