Context menu with some commands (#217)

This commit is contained in:
Timur Khazamov 2020-01-07 07:50:59 +05:00 committed by Christopher Chedeau
parent 9fe3fe5091
commit 257f697a98
6 changed files with 250 additions and 25 deletions

View file

@ -0,0 +1,24 @@
import React from "react";
type Props = {
top?: number;
left?: number;
children?: React.ReactNode;
onCloseRequest?(): void;
};
export function Popover({ children, left, onCloseRequest, top }: Props) {
return (
<div className="popover" style={{ top: top, left: left }}>
<div
className="cover"
onClick={onCloseRequest}
onContextMenu={e => {
e.preventDefault();
if (onCloseRequest) onCloseRequest();
}}
/>
{children}
</div>
);
}