2021-04-12 13:32:25 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import classnames from "classnames";
|
2021-02-11 16:22:22 +00:00
|
|
|
|
2021-03-03 16:51:39 +00:00
|
|
|
interface IStatusCellProps {
|
|
|
|
|
value: string;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-14 09:20:56 +00:00
|
|
|
const generateClassTag = (rawValue: string): string => {
|
2022-04-07 19:12:38 +00:00
|
|
|
if (rawValue === "---") {
|
|
|
|
|
return "indeterminate";
|
|
|
|
|
}
|
2021-04-14 16:52:15 +00:00
|
|
|
return rawValue.replace(" ", "-").toLowerCase();
|
2021-04-14 09:20:56 +00:00
|
|
|
};
|
|
|
|
|
|
2021-10-22 15:34:45 +00:00
|
|
|
const StatusCell = ({ value }: IStatusCellProps): JSX.Element => {
|
2021-02-11 16:22:22 +00:00
|
|
|
const statusClassName = classnames(
|
2021-04-12 13:32:25 +00:00
|
|
|
"data-table__status",
|
2021-04-14 16:52:15 +00:00
|
|
|
`data-table__status--${generateClassTag(value)}`
|
2021-02-11 16:22:22 +00:00
|
|
|
);
|
|
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
return <span className={statusClassName}>{value}</span>;
|
2021-02-11 16:22:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StatusCell;
|