mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
eslint fix
This commit is contained in:
parent
dfaac877fb
commit
fa4d51360b
81 changed files with 741 additions and 972 deletions
|
@ -1,17 +1,19 @@
|
|||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
useCallback, useEffect, useRef, useState
|
||||
} from 'react';
|
||||
|
||||
export const useCloseOnEscape = (onRequestClose: () => void, ignore_inputs = false) => {
|
||||
const onEscape = useCallback(
|
||||
event => {
|
||||
(event) => {
|
||||
if (event.key !== 'Escape') return;
|
||||
if (
|
||||
ignore_inputs &&
|
||||
(event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA')
|
||||
)
|
||||
return;
|
||||
ignore_inputs
|
||||
&& (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA')
|
||||
) return;
|
||||
|
||||
onRequestClose();
|
||||
},
|
||||
[onRequestClose],
|
||||
[ignore_inputs, onRequestClose],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -30,5 +32,5 @@ export const useDelayedReady = (setReady: (val: boolean) => void, delay: number
|
|||
return () => {
|
||||
if (timer) clearTimeout(timer);
|
||||
};
|
||||
}, []);
|
||||
}, [delay, setReady]);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue