diff --git a/convertPheno_client/src/code/views/conversion/ components/clinicalData/components/dataGrid/CopyOnClick.jsx b/convertPheno_client/src/code/views/conversion/ components/clinicalData/components/dataGrid/CopyOnClick.jsx index 223d62ac..614f63e5 100644 --- a/convertPheno_client/src/code/views/conversion/ components/clinicalData/components/dataGrid/CopyOnClick.jsx +++ b/convertPheno_client/src/code/views/conversion/ components/clinicalData/components/dataGrid/CopyOnClick.jsx @@ -45,16 +45,19 @@ const getValue = (props) => { const { data, colDef } = props; const field = colDef.field; - const [isTooltipOpen, setIsTooltipOpen] = useState(false); + // const [isTooltipOpen, setIsTooltipOpen] = useState(false); const [tooltipValue, setTooltipValue] = useState(""); + const [anchorEl, setAnchorEl] = useState(null); - const handleMouseOver = (value) => { + const handleMouseOver = (event, value) => { setTooltipValue(value); - setIsTooltipOpen(true); + console.log(event.currentTarget); + setAnchorEl(event.currentTarget); }; const handleMouseOut = () => { - setIsTooltipOpen(false); + setTooltipValue(""); + setAnchorEl(null); }; return checkKeyExists(data[field], "count") ? ( @@ -68,16 +71,27 @@ const getValue = (props) => { }} > {data[field]["values"].map((value, index) => ( - - handleMouseOver(value)} - onMouseOut={handleMouseOut} - > - {value} - {index === data[field]["values"].length - 1 ? "" : ", "} - - + + // + // handleMouseOver(event, value)} + // onMouseOut={handleMouseOut} + // > + // {value} + // {index === data[field]["values"].length - 1 ? "" : ", "} + // + // ))} + + {/* + Hidden span for the Tooltip + */} {/* {data[field]["values"].join(", ")} */} ) : ( @@ -85,6 +99,30 @@ const getValue = (props) => { ); }; +const ValueWithTooltip = ({ value }) => { + const [isTooltipOpen, setIsTooltipOpen] = useState(false); + + const handleMouseOver = () => { + setIsTooltipOpen(true); + }; + + const handleMouseOut = () => { + setIsTooltipOpen(false); + }; + + return ( + + + {value} + + + ); +}; + const PopoverButton = ({ children, onClick,