Добавление ts-prune и общего скрипта проверки

This commit is contained in:
2020-12-29 16:07:49 +03:00
parent 534fa35485
commit 7e9d8abd9c
10 changed files with 184 additions and 33 deletions

View File

@ -21,5 +21,3 @@ export const PAGE_TITLE = {
[PageType.Settings]: 'Settings',
[PageType.SigIn]: 'SigIn',
};
export const UTC_DATE_FORMAT = '';

View File

@ -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;
};