initial commit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-03-23 08:46:51 +01:00
commit 4608494a3f
130 changed files with 40361 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react'
interface ThemeContextValue {
theme: string
toggleTheme: () => void
}
const ThemeContext = createContext<ThemeContextValue | null>(null)
export function ThemeProvider({ children }: { children: ReactNode }) {
const [theme, setTheme] = useState(() => {
if (typeof window !== 'undefined') {
return localStorage.getItem('boha-theme') || 'dark'
}
return 'dark'
})
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme)
localStorage.setItem('boha-theme', theme)
const themeColor = theme === 'dark' ? '#12121a' : '#ffffff'
document.querySelector('meta[name="theme-color"]')?.setAttribute('content', themeColor)
}, [theme])
const toggleTheme = () => {
setTheme(prev => (prev === 'dark' ? 'light' : 'dark'))
}
return (
<ThemeContext.Provider value={{ theme, toggleTheme }}>
{children}
</ThemeContext.Provider>
)
}
export function useTheme(): ThemeContextValue {
const context = useContext(ThemeContext)
if (!context) throw new Error('useTheme must be used within a ThemeProvider')
return context
}