mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-13 04:20:05 +02:00
Context menu with some commands (#217)
This commit is contained in:

committed by
Christopher Chedeau

parent
9fe3fe5091
commit
257f697a98
24
src/components/Popover.tsx
Normal file
24
src/components/Popover.tsx
Normal 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>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user