2021-02-11 16:22:22 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import classnames from 'classnames';
|
|
|
|
|
|
2021-03-03 16:51:39 +00:00
|
|
|
interface IStatusCellProps {
|
|
|
|
|
value: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
const generateClassTag = (rawValue: string): string => {
|
|
|
|
|
const classTag = rawValue.replace(' ', '-').toLowerCase();
|
|
|
|
|
|
|
|
|
|
return classTag;
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-11 16:22:22 +00:00
|
|
|
const statusClassName = classnames(
|
2021-03-31 16:30:21 +00:00
|
|
|
'data-table__status',
|
2021-04-09 10:44:57 +00:00
|
|
|
`data-table__status--${generateClassTag(value)}`,
|
2021-02-11 16:22:22 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<span className={statusClassName}>
|
|
|
|
|
{value}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default StatusCell;
|