2023-01-05 15:23:40 +01:00
|
|
|
import { Chip, styled } from '@mui/material';
|
2021-11-12 11:47:19 +01:00
|
|
|
|
|
|
|
interface IStatusChip {
|
|
|
|
stale: boolean;
|
2022-05-02 12:52:33 +02:00
|
|
|
showActive?: boolean;
|
2021-11-12 11:47:19 +01:00
|
|
|
}
|
|
|
|
|
2023-01-05 15:23:40 +01:00
|
|
|
const StyledChip = styled(Chip)(({ theme }) => ({
|
|
|
|
background: 'transparent',
|
|
|
|
border: `1px solid ${theme.palette.primary.main}`,
|
|
|
|
color: theme.palette.primary.main,
|
|
|
|
}));
|
|
|
|
|
2022-11-02 16:05:27 +01:00
|
|
|
export const FeatureStatusChip = ({
|
|
|
|
stale,
|
|
|
|
showActive = true,
|
|
|
|
}: IStatusChip) => {
|
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' }}>
|
2023-01-05 15:23:40 +01:00
|
|
|
<StyledChip
|
2021-11-12 11:47:19 +01:00
|
|
|
color="primary"
|
|
|
|
variant="outlined"
|
|
|
|
title={title}
|
|
|
|
label={value}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|