mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
Enhance DataTable and related components to enable multiple buttons for actions on selected rows - Create new subcomponent ActionButton for DataTable - Add renderPrimarySelectAction and renderSecondarySelectActions - Add renderActionButton - Refactor selectActionButtonText and onSelectActionClick as primarySelectActionButtonText and onPrimarySelectActionButtonText - Refactor ManageHostsPage to conform to above change - Refactor TextCell component to enable it to display boolean values in text
23 lines
461 B
TypeScript
23 lines
461 B
TypeScript
import React from "react";
|
|
|
|
interface ITextCellProps {
|
|
value: string | number | boolean;
|
|
formatter?: (val: any) => string;
|
|
}
|
|
|
|
const TextCell = (props: ITextCellProps): JSX.Element => {
|
|
const {
|
|
value,
|
|
formatter = (val) => val, // identity function if no formatter is provided
|
|
} = props;
|
|
|
|
let val = value;
|
|
|
|
if (typeof value === "boolean") {
|
|
val = value.toString();
|
|
}
|
|
|
|
return <span>{formatter(val)}</span>;
|
|
};
|
|
|
|
export default TextCell;
|