mirror of
https://github.com/fleetdm/fleet
synced 2026-04-30 09:57:37 +00:00
## Addresses #9834 <img width="1215" alt="added date to vuln table" src="https://user-images.githubusercontent.com/61553566/226730586-4165f5c9-2a42-4378-b58b-7900838a8707.png"> ## Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/` - [x] Added/updated tests - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
29 lines
741 B
TypeScript
29 lines
741 B
TypeScript
import React from "react";
|
|
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants";
|
|
|
|
interface ITextCellProps {
|
|
value?: string | number | boolean | { timeString: string };
|
|
formatter?: (val: any) => JSX.Element | string; // string, number, or null
|
|
greyed?: boolean;
|
|
classes?: string;
|
|
}
|
|
|
|
const TextCell = ({
|
|
value,
|
|
formatter = (val) => val, // identity function if no formatter is provided
|
|
greyed,
|
|
classes = "w250",
|
|
}: ITextCellProps): JSX.Element => {
|
|
let val = value;
|
|
|
|
if (typeof value === "boolean") {
|
|
val = value.toString();
|
|
}
|
|
return (
|
|
<span className={`text-cell ${classes} ${greyed && "grey-cell"}`}>
|
|
{formatter(val) || DEFAULT_EMPTY_CELL_VALUE}
|
|
</span>
|
|
);
|
|
};
|
|
|
|
export default TextCell;
|