Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paales committed Jun 5, 2024
1 parent 53ee50c commit e451395
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/next-ui/Theme/DarkLightModeThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function DarkLightModeThemeProvider(props: ThemeProviderProps) {
const [configuredMode, setConfiguredMode] = useState<UserMode>(listenToBrowser ? 'auto' : ssrMode)
const setThemeMode = (mode: UserMode) => {
setConfiguredMode(mode)
setCssFlag('configuredMode', mode)
setCssFlag('color-scheme', mode)
}

const browserMode: Mode = useMediaQuery('(prefers-color-scheme: dark)') ? 'dark' : 'light'
Expand All @@ -64,10 +64,8 @@ export function DarkLightModeThemeProvider(props: ThemeProviderProps) {
else if (dark) theme = dark

useEffect(() => {
const flag = getCssFlag('configuredMode') as Mode
if (flag) {
setConfiguredMode(flag)
}
const flag = getCssFlag('color-scheme') as Mode
if (flag) setConfiguredMode(flag)
}, [setConfiguredMode])

// If a URL parameter is present, switch from auto to light or dark mode
Expand Down

0 comments on commit e451395

Please sign in to comment.