This commit is contained in:
2023-08-11 00:49:30 +02:00
parent 9703d24784
commit 3dcd5f1ef6
33 changed files with 4010 additions and 2699 deletions

28
src/store/color.ts Normal file
View File

@@ -0,0 +1,28 @@
import { defineStore } from 'pinia'
import { ColorsTheme } from '~~/types'
export const useColorStore = defineStore(
'color',
() => {
const colorCookie = useCookie('color', { path: '/', default: () => ColorsTheme.RED })
const appConfig = useAppConfig()
watch(colorCookie, (newColor) => {
appConfig.ui.primary = newColor
}, { immediate: true })
const setColor = (color: string) => {
colorCookie.value = color as ColorsTheme
}
const getColor = computed(() => colorCookie)
return {
getColor,
setColor,
}
},
{
persist: true,
},
)