refactor: use head script instead of cookie

This commit is contained in:
Anthony Fu 2023-01-14 10:34:53 +01:00
parent dcf0dd7018
commit 55aff4778b
8 changed files with 62 additions and 45 deletions

View file

@ -0,0 +1,10 @@
import { fontSizeMap } from '~/constants/options'
import { DEFAULT_FONT_SIZE } from '~/constants'
export default defineNuxtPlugin(() => {
const userSettings = useUserSettings()
const html = document.querySelector('html')!
watchEffect(() => {
html.style.setProperty('--font-size', fontSizeMap[userSettings.value.fontSize || DEFAULT_FONT_SIZE])
})
})