mirror of
https://github.com/faiztyanirh/clqms-shadcn-v1.git
synced 2026-04-25 18:42:05 +07:00
20 lines
405 B
JavaScript
20 lines
405 B
JavaScript
export function useResponsive(breakpoint = 768) {
|
|
let isMobile = $state(false);
|
|
|
|
$effect(() => {
|
|
const checkMobile = () => {
|
|
isMobile = window.innerWidth < breakpoint;
|
|
};
|
|
|
|
checkMobile();
|
|
window.addEventListener("resize", checkMobile);
|
|
|
|
return () => window.removeEventListener("resize", checkMobile);
|
|
});
|
|
|
|
return {
|
|
get isMobile() {
|
|
return isMobile;
|
|
},
|
|
};
|
|
} |