fleet/frontend/components/TableContainer/DataTable/InternalLinkCell/InternalLinkCell.tsx
Gabriel Hernandez 2d1caa84d4
rollup the mdm solutions by name on the dashboard page (#17297)
relates to #16837 

This rolls up the mdm solutions by name so that we only see one instance
of the mdm name. Clicking on this will then open a modal that shows the
server URLs and # of hosts for the mdm solution.

**Before:**

<img width="759" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/2e8e6187-d987-42c3-8b8f-aa0552869578">

**After:**

<img width="768" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/ff92199a-a9f8-4e42-8bb7-b626979c79d5">

**New modal:**

<img width="822" alt="image"
src="https://github.com/fleetdm/fleet/assets/1153709/88891630-352a-4aa6-999c-e25907a27ad0">


- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [x] Manual QA for all new/changed functionality
2024-03-04 13:14:50 +00:00

43 lines
1.2 KiB
TypeScript

import React from "react";
import classnames from "classnames";
import { noop } from "lodash";
import Icon from "components/Icon";
const baseClass = "internal-link-cell";
interface IInternalLinkCellProps {
value: string;
onClick?: () => void;
className?: string;
}
/** This cell is used when you want a clickable cell value that does not link
* to an url. This can be used when you'd like to trigger an action when the
* cell is clicked such as opening a modal.
*
* TODO: can we find a way to combine this with LinkCell. Would we want to do that?
* Also we can improve naming of this component.
*/
const InternalLinkCell = ({
value,
onClick = noop,
className,
}: IInternalLinkCellProps) => {
const classNames = classnames(baseClass, className);
return (
<div className={classNames}>
{/* The content div is to ensure that the clickable area is contained to
the text and icon. This is to prevent the entire cell from being
clickable. TODO: Figure out if this is product wants to hand this.
*/}
<div className={`${baseClass}__content`} onClick={onClick}>
<span>{value}</span>
<Icon name="arrow-internal-link" />
</div>
</div>
);
};
export default InternalLinkCell;