feat: add search menu to all resources

This commit is contained in:
2023-08-06 00:33:06 +02:00
parent 32a7f89309
commit 0e0d26c939
12 changed files with 208 additions and 8 deletions

View File

@ -0,0 +1,24 @@
// useDebouncedCallback.tsx
import { useEffect, useState } from "preact/hooks";
const useDebouncedCallback = (
callback: (...args: any[]) => void,
delay: number,
) => {
const [debouncedCallback, setDebouncedCallback] = useState(() => callback);
useEffect(() => {
const debounceHandler = setTimeout(() => {
setDebouncedCallback(() => callback);
}, delay);
return () => {
clearTimeout(debounceHandler);
};
}, [callback, delay]);
return debouncedCallback;
};
export default useDebouncedCallback;