mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
96399c7112
* feat: filters in plane deploy implemented multi-level dropdown for plane deploy * style: spacing and fonts * feat: plane deploy implemented authentication/theming, created/modified all the required store & services * devL reactions, voting, comments and theme
22 lines
430 B
TypeScript
22 lines
430 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
const useOutSideClick = (ref: any, callback: any) => {
|
|
const handleClick = (e: any) => {
|
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
callback();
|
|
}
|
|
};
|
|
|
|
useEffect(() => {
|
|
document.addEventListener("click", handleClick);
|
|
|
|
return () => {
|
|
document.removeEventListener("click", handleClick);
|
|
};
|
|
});
|
|
};
|
|
|
|
export default useOutSideClick;
|