feat: Add foundational UI components, pages, and theme management for the e-learning application.

This commit is contained in:
supalerk-ar66 2026-01-27 14:02:07 +07:00
parent baf389643b
commit 5fe454df95
12 changed files with 359 additions and 338 deletions

View file

@ -13,17 +13,7 @@ export const useThemeMode = () => {
localStorage.setItem('theme', value ? 'dark' : 'light')
}
const initTheme = () => {
if (!process.client) return
const saved = localStorage.getItem('theme') // 'dark' | 'light' | null
const prefersDark = window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false
const value = saved ? saved === 'dark' : prefersDark
isDark.value = value
applyTheme(value)
}
onMounted(initTheme)
watch(isDark, (v) => applyTheme(v))