21 lines
548 B
TypeScript
21 lines
548 B
TypeScript
|
import { useMenu } from "contexts/menu";
|
||
|
import type { ContextMenuCapture } from "contexts/menu/useMenuContextState";
|
||
|
import { useMemo } from "react";
|
||
|
|
||
|
const useAddressBarContextMenu = (address: string): ContextMenuCapture => {
|
||
|
const { contextMenu } = useMenu();
|
||
|
|
||
|
return useMemo(
|
||
|
() =>
|
||
|
contextMenu?.(() => [
|
||
|
{
|
||
|
action: () => navigator.clipboard?.writeText(address),
|
||
|
label: "Copy address",
|
||
|
},
|
||
|
]),
|
||
|
[address, contextMenu]
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default useAddressBarContextMenu;
|