1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/common/FeatureStatusChip/FeatureStatusChip.tsx

38 lines
866 B
TypeScript
Raw Normal View History

2023-01-05 15:23:40 +01:00
import { Chip, styled } from '@mui/material';
interface IStatusChip {
stale: boolean;
showActive?: boolean;
}
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,
}));
export const FeatureStatusChip = ({
stale,
showActive = true,
}: IStatusChip) => {
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
color="primary"
variant="outlined"
title={title}
label={value}
/>
</div>
);
};