You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
500 B
23 lines
500 B
import useContextMenuStore from "@/hooks/useContextMenuStore";
|
|
import { Component } from "@/typings/component";
|
|
import { ContextMenuItem } from "@/typings/contextMenu";
|
|
|
|
export const ContextMenu: Component<{ menu: ContextMenuItem[] }> = ({
|
|
menu,
|
|
children
|
|
}) => {
|
|
const showContextMenu = useContextMenuStore((state) => state.showContextMenu);
|
|
|
|
return (
|
|
<div
|
|
onContextMenu={(e) => {
|
|
e.preventDefault();
|
|
|
|
showContextMenu(e.pageX, e.pageY, menu);
|
|
}}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
};
|