chore: fix linting errors and ts bugs.

This commit is contained in:
syntaxbullet
2026-06-17 17:41:21 +02:00
parent 3e04a3c7e3
commit 51494e25a8
41 changed files with 285 additions and 251 deletions

View File

@@ -16,7 +16,9 @@ import { themeLocalStorageKey } from './types'
export const ThemeSelector: React.FC = () => {
const { setTheme } = useTheme()
const [value, setValue] = useState('')
const [value, setValue] = useState(() =>
typeof window === 'undefined' ? 'auto' : window.localStorage.getItem(themeLocalStorageKey) ?? 'auto',
)
const onThemeChange = (themeToSet: Theme & 'auto') => {
if (themeToSet === 'auto') {
@@ -28,10 +30,6 @@ export const ThemeSelector: React.FC = () => {
}
}
React.useEffect(() => {
const preference = window.localStorage.getItem(themeLocalStorageKey)
setValue(preference ?? 'auto')
}, [])
return (
<Select onValueChange={onThemeChange} value={value}>