diff --git a/src/client/ComboBox.tsx b/src/client/ComboBox.tsx index 81c65fe..be2b008 100644 --- a/src/client/ComboBox.tsx +++ b/src/client/ComboBox.tsx @@ -1,6 +1,6 @@ import { type ComponentChildren } from 'preact' import { useState, useRef, useEffect } from 'preact/hooks' -import { clsx } from './lib/util' +import { clsx, isMobile } from './lib/util' export const ComboBox = ({ value, @@ -33,7 +33,11 @@ export const ComboBox = ({ }, []) return ( -
+
setOpen(!open)}>
{children[value]}
expand_more diff --git a/src/client/lib/util.ts b/src/client/lib/util.ts index 38450a9..6bb94f8 100644 --- a/src/client/lib/util.ts +++ b/src/client/lib/util.ts @@ -1,3 +1,5 @@ +import { useEffect, useMemo, useState } from 'preact/hooks' + export const trottleDebounce = ( fn: (...args: T) => R, delay: number, @@ -52,3 +54,13 @@ export function clsx(...args: ClassValue[]): string { }) .join(' ') } + +export const isMobile = () => { + const [windowWidth, setWindowWidth] = useState(0) + + useEffect(() => { + setWindowWidth(window.innerWidth) + }, []) + + return windowWidth < 1024 +} diff --git a/src/components/Header.astro b/src/components/Header.astro index bd2effd..200bc68 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,7 +2,8 @@ -