securityos/components/apps/FileExplorer/useAddressBarContextMenu.ts

21 lines
548 B
TypeScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
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;