2023-08-22 13:20:40 +00:00
|
|
|
// Utilizes Link over Button so we can right click links
|
2021-04-12 13:32:25 +00:00
|
|
|
import React from "react";
|
2022-04-22 16:45:35 +00:00
|
|
|
|
2023-08-22 13:20:40 +00:00
|
|
|
import { Link } from "react-router";
|
|
|
|
|
import classnames from "classnames";
|
2021-02-11 16:22:22 +00:00
|
|
|
|
2022-04-07 19:12:38 +00:00
|
|
|
interface ILinkCellProps {
|
2023-03-06 20:57:15 +00:00
|
|
|
value: string | JSX.Element;
|
2021-04-29 13:47:33 +00:00
|
|
|
path: string;
|
2023-08-22 13:20:40 +00:00
|
|
|
className?: string;
|
|
|
|
|
customOnClick?: (e: React.MouseEvent) => void;
|
|
|
|
|
/** allows viewing overflow for tooltip */
|
|
|
|
|
withTooltip?: boolean;
|
2021-04-29 13:47:33 +00:00
|
|
|
title?: string;
|
2021-03-03 16:51:39 +00:00
|
|
|
}
|
|
|
|
|
|
2023-08-22 13:20:40 +00:00
|
|
|
const baseClass = "link-cell";
|
|
|
|
|
|
2022-04-07 19:12:38 +00:00
|
|
|
const LinkCell = ({
|
|
|
|
|
value,
|
|
|
|
|
path,
|
2023-08-22 13:20:40 +00:00
|
|
|
className,
|
2023-05-08 13:17:19 +00:00
|
|
|
customOnClick,
|
2023-08-22 13:20:40 +00:00
|
|
|
withTooltip,
|
|
|
|
|
title,
|
2022-04-07 19:12:38 +00:00
|
|
|
}: ILinkCellProps): JSX.Element => {
|
2023-08-22 13:20:40 +00:00
|
|
|
const cellClasses = classnames(
|
|
|
|
|
baseClass,
|
|
|
|
|
className,
|
|
|
|
|
withTooltip && "link-cell-tooltip"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const onClick = (e: React.MouseEvent): void => {
|
|
|
|
|
customOnClick && customOnClick(e);
|
2021-02-11 16:22:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2023-08-22 13:20:40 +00:00
|
|
|
<Link className={cellClasses} to={path} onClick={onClick} title={title}>
|
2021-02-11 16:22:22 +00:00
|
|
|
{value}
|
2023-08-22 13:20:40 +00:00
|
|
|
</Link>
|
2021-02-11 16:22:22 +00:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default LinkCell;
|