Fix checking prefers-color-scheme media query

This commit is contained in:
Gaeulbyul 2021-09-21 20:28:36 +09:00 committed by GitHub
parent 9b1a75fd90
commit b5b628ae3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ import { useEffect } from 'react';
export default function useTheme() {
const defaultTheme =
typeof window !== 'undefined'
? window?.matchMedia('prefers-color-scheme: dark')?.matches
? window?.matchMedia('(prefers-color-scheme: dark)')?.matches
? 'dark'
: 'light'
: 'light';