Bump Nuxt + Minor Fixes (#1065)

* Bump Nuxt + Minor Fixes

* Run lint
This commit is contained in:
Geometrically
2023-03-27 09:20:25 -07:00
committed by GitHub
parent 25bd61558b
commit 7214b71c29
13 changed files with 1395 additions and 1582 deletions

View File

@@ -1,24 +1,23 @@
export default defineNuxtPlugin((nuxtApp) => {
const themeStore = useTheme()
// TODO: Temporarily removed as it was causing hydration issues
// nuxtApp.hook('app:mounted', () => {
// if (process.client && themeStore.value.preference === 'system') {
// const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: light)')
//
// const setColorScheme = (e) => {
// if (themeStore.value.preference === 'system') {
// if (e.matches) {
// updateTheme('light')
// } else {
// updateTheme('dark')
// }
// }
// }
//
// setColorScheme(colorSchemeQueryList)
// colorSchemeQueryList.addEventListener('change', setColorScheme)
// }
// })
nuxtApp.hook('app:mounted', () => {
if (process.client && themeStore.value.preference === 'system') {
const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: light)')
const setColorScheme = (e) => {
if (themeStore.value.preference === 'system') {
if (e.matches) {
updateTheme('light')
} else {
updateTheme('dark')
}
}
}
setColorScheme(colorSchemeQueryList)
colorSchemeQueryList.addEventListener('change', setColorScheme)
}
})
nuxtApp.provide('colorMode', themeStore.value)
})