mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-17 19:16:25 +00:00
24 lines
459 B
TypeScript
24 lines
459 B
TypeScript
"use client"
|
|
|
|
import { useEffect, useState } from "react"
|
|
|
|
export function useIsMobile() {
|
|
const [isMobile, setIsMobile] = useState(false)
|
|
|
|
useEffect(() => {
|
|
const checkMobile = () => {
|
|
setIsMobile(window.innerWidth < 768)
|
|
}
|
|
|
|
// Check on mount
|
|
checkMobile()
|
|
|
|
// Listen for resize
|
|
window.addEventListener("resize", checkMobile)
|
|
|
|
return () => window.removeEventListener("resize", checkMobile)
|
|
}, [])
|
|
|
|
return isMobile
|
|
}
|