/******************************************************************************** * Copyright (c) 2020 TypeFox and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ import { FunctionComponent, PropsWithChildren, ReactNode, useState } from 'react'; import { Popover } from "@mui/material"; export const HoverPopover: FunctionComponent> = props => { const [anchor, setAnchor] = useState(null); return <>
setAnchor(event.currentTarget)} onMouseLeave={() => setAnchor(null)} > {props.children}
setAnchor(null)} disableRestoreFocus sx={{ pointerEvents: 'none', '& .MuiPopover-paper': { p: 1, maxWidth: '80%' } }} > {props.popupContent} ; }; export interface HoverPopoverProps { id: string; popupContent: ReactNode; className?: string; }