39 lines
957 B
TypeScript
39 lines
957 B
TypeScript
![]() |
import { Button, ClickAwayListener, IconButton, Tooltip } from "@mui/material";
|
||
|
import InfoIcon from "@icons/InfoIcon";
|
||
|
import { useState } from "react";
|
||
|
|
||
|
export default function TooltipClickInfo({ title }: string) {
|
||
|
const [open, setOpen] = useState(false);
|
||
|
|
||
|
const handleTooltipClose = () => {
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
const handleTooltipOpen = () => {
|
||
|
setOpen(true);
|
||
|
};
|
||
|
return (
|
||
|
<>
|
||
|
<ClickAwayListener onClickAway={handleTooltipClose}>
|
||
|
<div>
|
||
|
<Tooltip
|
||
|
PopperProps={{
|
||
|
disablePortal: true,
|
||
|
}}
|
||
|
onClose={handleTooltipClose}
|
||
|
open={open}
|
||
|
disableFocusListener
|
||
|
disableHoverListener
|
||
|
disableTouchListener
|
||
|
title={title}
|
||
|
>
|
||
|
<IconButton onClick={handleTooltipOpen}>
|
||
|
<InfoIcon />
|
||
|
</IconButton>
|
||
|
</Tooltip>
|
||
|
</div>
|
||
|
</ClickAwayListener>
|
||
|
</>
|
||
|
);
|
||
|
}
|