excalidraw/src/components/Popover.tsx

25 lines
518 B
TypeScript
Raw Normal View History

2020-01-07 07:50:59 +05:00
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>
);
}