refactor: use @nuxtjs/color-mode to manage ssr (#612)

This commit is contained in:
Daniel Roe 2022-12-29 13:26:08 +01:00 committed by GitHub
parent 6fdcc558fc
commit 7a36fb8efd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 43 additions and 215 deletions

View file

@ -1,14 +1,5 @@
import { InjectionKeyColorMode, InjectionKeyFontSize } from '~/constants/symbols'
import { InjectionKeyFontSize } from '~/constants/symbols'
export function useFontSizeRef() {
return inject(InjectionKeyFontSize)!
}
export function useColorModeRef() {
return inject(InjectionKeyColorMode)!
}
export function toggleColorMode() {
const colorMode = useColorModeRef()
colorMode.value = colorMode.value === 'light' ? 'dark' : 'light'
}