2020-09-11 11:25:48 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { Tooltip } from "@blueprintjs/core";
|
|
|
|
|
import { IconWrapper } from "constants/IconConstants";
|
|
|
|
|
import { Colors } from "constants/Colors";
|
2021-09-09 15:10:22 +00:00
|
|
|
import { TableIconWrapper } from "./TableStyledWrappers";
|
2020-09-11 11:25:48 +00:00
|
|
|
|
|
|
|
|
interface TableActionIconProps {
|
|
|
|
|
tooltip: string;
|
|
|
|
|
selected: boolean;
|
|
|
|
|
selectMenu: (selected: boolean) => void;
|
|
|
|
|
className: string;
|
|
|
|
|
children: React.ReactNode;
|
|
|
|
|
icon?: React.ReactNode;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
function TableActionIcon(props: TableActionIconProps) {
|
2020-09-11 11:25:48 +00:00
|
|
|
return (
|
|
|
|
|
<Tooltip
|
|
|
|
|
autoFocus={false}
|
|
|
|
|
content={props.tooltip}
|
2021-04-28 10:28:39 +00:00
|
|
|
hoverOpenDelay={1000}
|
2020-09-11 11:25:48 +00:00
|
|
|
modifiers={{
|
|
|
|
|
preventOverflow: { enabled: false },
|
|
|
|
|
flip: { enabled: false },
|
|
|
|
|
}}
|
2021-04-28 10:28:39 +00:00
|
|
|
position="top"
|
2020-09-11 11:25:48 +00:00
|
|
|
>
|
|
|
|
|
<TableIconWrapper
|
2021-04-28 10:28:39 +00:00
|
|
|
className={props.className}
|
2020-12-24 04:32:25 +00:00
|
|
|
onClick={(e) => {
|
2020-09-11 11:25:48 +00:00
|
|
|
props.selectMenu(!props.selected);
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}}
|
2021-04-28 10:28:39 +00:00
|
|
|
selected={props.selected}
|
2020-09-11 11:25:48 +00:00
|
|
|
>
|
|
|
|
|
<IconWrapper
|
2021-05-10 11:24:50 +00:00
|
|
|
color={props.selected ? Colors.CODE_GRAY : Colors.GRAY}
|
2021-04-28 10:28:39 +00:00
|
|
|
height={20}
|
|
|
|
|
width={20}
|
2020-09-11 11:25:48 +00:00
|
|
|
>
|
|
|
|
|
{props.children}
|
|
|
|
|
</IconWrapper>
|
|
|
|
|
</TableIconWrapper>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2020-09-11 11:25:48 +00:00
|
|
|
|
|
|
|
|
export default TableActionIcon;
|