edit layout for small resolution screens

This commit is contained in:
smanylov
2026-01-23 15:43:05 +07:00
parent 38ce69047d
commit f8ab107724
22 changed files with 367 additions and 140 deletions
+7 -4
View File
@@ -4,14 +4,17 @@ import { useEffect, RefObject } from 'react';
export function useClickOutside(
ref: RefObject<HTMLDivElement | null>,
callback: () => void
callback: () => void,
isActive: boolean = true
) {
useEffect(() => {
if (!isActive) return;
const handleClick = (event: MouseEvent) => {
if (!ref) {
if (!ref?.current) {
return;
}
if (ref.current && !ref.current.contains(event.target as Node)) {
if (!ref.current.contains(event.target as Node)) {
callback();
}
};
@@ -20,5 +23,5 @@ export function useClickOutside(
return () => {
document.removeEventListener('mousedown', handleClick);
};
}, [ref, callback]);
}, [ref, callback, isActive]);
}