2022-05-02 15:52:41 +02:00
|
|
|
import { Chip } from '@mui/material';
|
2021-11-12 11:47:19 +01:00
|
|
|
import { useStyles } from './StatusChip.styles';
|
|
|
|
|
|
|
|
interface IStatusChip {
|
|
|
|
stale: boolean;
|
2022-05-02 12:52:33 +02:00
|
|
|
showActive?: boolean;
|
2021-11-12 11:47:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const StatusChip = ({ stale, showActive = true }: IStatusChip) => {
|
2022-05-02 15:52:41 +02:00
|
|
|
const { classes: styles } = useStyles();
|
2021-11-12 11:47:19 +01:00
|
|
|
|
|
|
|
if (!stale && !showActive) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const title = stale
|
|
|
|
? 'Feature toggle is deprecated.'
|
|
|
|
: 'Feature toggle is active.';
|
|
|
|
const value = stale ? 'Stale' : 'Active';
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div data-loading style={{ marginLeft: '8px' }}>
|
|
|
|
<Chip
|
|
|
|
color="primary"
|
|
|
|
variant="outlined"
|
|
|
|
className={styles.chip}
|
|
|
|
title={title}
|
|
|
|
label={value}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default StatusChip;
|