Добавление ts-prune и общего скрипта проверки
This commit is contained in:
@ -21,5 +21,3 @@ export const PAGE_TITLE = {
|
||||
[PageType.Settings]: 'Settings',
|
||||
[PageType.SigIn]: 'SigIn',
|
||||
};
|
||||
|
||||
export const UTC_DATE_FORMAT = '';
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
import {useCallback, useEffect, useRef} from 'react';
|
||||
|
||||
export const useOutsideClick = <T extends HTMLElement>(callback: EventListener) => {
|
||||
const container = useRef<T>(null);
|
||||
|
||||
const handleEvent = useCallback((e: Event) => {
|
||||
if (container.current && e.target !== null) {
|
||||
if (!container.current.contains(e.target as Node)) {
|
||||
callback(e);
|
||||
}
|
||||
}
|
||||
}, [callback]);
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('mousedown', handleEvent, true);
|
||||
document.addEventListener('touchstart', handleEvent, true);
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleEvent, true);
|
||||
document.removeEventListener('touchstart', handleEvent, true);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return container;
|
||||
};
|
||||
Reference in New Issue
Block a user