forked from phc/website
feat: header and utenti page mobile friendly
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'preact/hooks'
|
||||
|
||||
export const trottleDebounce = <T extends any[], R>(
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user