Skip to content

Commit

Permalink
Fixed failing prettier check
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-harness committed Nov 16, 2024
1 parent 450b538 commit 18a9db8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/views/src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ export function ThemeProvider({
const getMediaQuery = () => window.matchMedia('(prefers-color-scheme: dark)')

const [theme, setThemeState] = useState<Theme>(() => (localStorage.getItem(storageKey) as Theme) || defaultTheme)
const [systemTheme, setSystemTheme] = useState<'dark' | 'light'>(() =>
getMediaQuery().matches ? 'dark' : 'light'
)
const [systemTheme, setSystemTheme] = useState<'dark' | 'light'>(() => (getMediaQuery().matches ? 'dark' : 'light'))

useEffect(() => {
const root = window.document.documentElement
root.classList.remove('light', 'dark')

const applyTheme = theme === 'system' ? systemTheme : theme
root.classList.add(applyTheme)
}, [theme, systemTheme])
}, [theme, systemTheme])

useEffect(() => {
const updateSystemTheme = () => setSystemTheme(getMediaQuery().matches ? 'dark' : 'light')
Expand Down

0 comments on commit 18a9db8

Please sign in to comment.