chore: pre-chore

This commit is contained in:
Leifer Mendez
2023-02-04 18:03:57 +01:00
parent 99b9b17f52
commit 2ecc41f3f0
82 changed files with 411 additions and 904 deletions

View File

@@ -10,16 +10,13 @@ interface ItemProps {
export default component$((props: ItemProps) => {
const { iconClass } = props
const store = useStore({
theme:
(typeof window !== 'undefined' && window?.localStorage?.theme) ||
undefined,
theme: (typeof window !== 'undefined' && window?.localStorage?.theme) || undefined,
})
useClientEffect$(() => {
store.theme =
window.localStorage.theme === 'dark' ||
(!('theme' in window.localStorage) &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
(!('theme' in window.localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
? 'dark'
: 'light'
})
@@ -42,11 +39,7 @@ export default component$((props: ItemProps) => {
}
}}
>
{store.theme == 'dark' ? (
<IconMoon class={iconClass} />
) : (
<IconSun class={iconClass} />
)}
{store.theme == 'dark' ? <IconMoon class={iconClass} /> : <IconSun class={iconClass} />}
</button>
)
})