import { component$, useStore, useClientEffect$ } from '@builder.io/qwik' import { IconSun } from '~/components/icons/IconSun' import { IconMoon } from '../icons/IconMoon' interface ItemProps { iconClass?: string } export default component$((props: ItemProps) => { const { iconClass } = props const store = useStore({ 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) ? 'dark' : 'light' }) return ( ) })