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 => {
|
2021-04-14 16:52:15 +00:00
|
|
|
return rawValue.replace(" ", "-").toLowerCase();
|
2021-04-14 09:20:56 +00:00
|
|
|
};
|
|
|
|
|
|
2021-03-03 16:51:39 +00:00
|
|
|
const StatusCell = (props: IStatusCellProps): JSX.Element => {
|
2021-02-11 16:22:22 +00:00
|
|
|
const { value } = props;
|
2021-04-09 10:44:57 +00:00
|
|
|
|
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;
|