mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-11-28 08:29:57 +00:00
Update domain references to pezkuwichain.app and rebrand from polkadot
This commit is contained in:
commit
c2913a65d9
401 files changed
+23179
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// Copyright 2019-2025 @pezkuwi/extension-ui authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { RefObject } from 'react';
|
||||
|
||||
import { useCallback, useEffect } from 'react';
|
||||
|
||||
export default function useOutsideClick (refs: RefObject<HTMLDivElement|null>[], callback: () => void): void {
|
||||
const handleClick = useCallback((e: MouseEvent): void => {
|
||||
refs.every(({ current }) =>
|
||||
current &&
|
||||
!current.contains(e.target as HTMLInputElement)
|
||||
) && callback();
|
||||
}, [callback, refs]);
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('click', handleClick);
|
||||
|
||||
return (): void => {
|
||||
document.removeEventListener('click', handleClick);
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user