From 64fedd9306fe77037b806284e43afb55e4ffea99 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 8 Jan 2024 00:53:58 +0200 Subject: [PATCH] fix: eslint warn --- src/layouts/MainLayout.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layouts/MainLayout.tsx b/src/layouts/MainLayout.tsx index fd3ecf2..c24b874 100644 --- a/src/layouts/MainLayout.tsx +++ b/src/layouts/MainLayout.tsx @@ -32,8 +32,9 @@ const MainLayout = () => { useEffect(() => { if (!mainRef.current) return; - const isLight = localStorage.getItem(LocalStorageKeys.LIGHT_THEME); - + const isLight = + localStorage.getItem(LocalStorageKeys.LIGHT_THEME) || + (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches); if (isLight || !isWelcome) { mainRef.current.style.backgroundColor = ''; } else if (!isLight && isWelcome) {