|
|
|
|
@ -38,9 +38,11 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
@@ -38,9 +38,11 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
|
|
|
|
|
className="context-menu" |
|
|
|
|
onContextMenu={(event) => event.preventDefault()} |
|
|
|
|
> |
|
|
|
|
{options.map((option, idx) => ( |
|
|
|
|
{options.map(({ action, label }, idx) => ( |
|
|
|
|
<li key={idx} onClick={onCloseRequest}> |
|
|
|
|
<ContextMenuOption {...option} /> |
|
|
|
|
<button className="context-menu-option" onClick={action}> |
|
|
|
|
{label} |
|
|
|
|
</button> |
|
|
|
|
</li> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
@ -49,12 +51,6 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
@@ -49,12 +51,6 @@ const ContextMenu = ({ options, onCloseRequest, top, left }: Props) => {
|
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const ContextMenuOption = ({ label, action }: ContextMenuOption) => ( |
|
|
|
|
<button className="context-menu-option" onClick={action}> |
|
|
|
|
{label} |
|
|
|
|
</button> |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
let contextMenuNode: HTMLDivElement; |
|
|
|
|
const getContextMenuNode = (): HTMLDivElement => { |
|
|
|
|
if (contextMenuNode) { |
|
|
|
|
|