Merge pull request #793 from gaeulbyul/patch-1

Fix checking prefers-color-scheme media query
This commit is contained in:
Mike Cao 2021-09-23 09:53:08 -07:00 committed by GitHub
commit f1520fbb29
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';