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/StatusChip/StatusChip.tsx

35 lines
799 B
TypeScript
Raw Normal View History

import { Chip } from '@material-ui/core';
import { useStyles } from './StatusChip.styles';
interface IStatusChip {
stale: boolean;
feat: add new feature metrics page (#716) * refactor: ensure that [hidden] overrides other display styles * refactor: use numeric font weights * refactor: remove unnecessary Jest mock * refactor: add a fullWidth prop to GeneralSelect * refactor: remove unnecessary label id prop * refactor: the showActive prop is optional * refactor: add hooks for managing query string state * refactor: add a hour/minute timestamp formatter * refactor: add labels to button icons * feat: add new feature metrics page * refactor: remove prev feature metrics page * refactor: use new metric boxes on overview page * refactor: lazy-load the new metrics page * refactor: fix type error when formatting unknown error * refactor: extract interfaces for props * refactor: destructure all props * refactor: expand arg names * refactor: reorg component dirs and files * refactor: improve chart element label * refactor: hide chart dots until hover * refactor: add section titles to environments/applications * refactor: simplify FeatureMetricsHours types * refactor: sort chart tooltip items * refactor: add more chart labels * refactor: always show a dot in single point charts * refactor: improve chart tooltip styles * refactor: adjut metric page spacing * refactor: decrease legend box size * refactor: move date fmt fn inline * refactor: improve chart legend styles * refactor: increase Cypress timeouts * refactor: sort environment and application chips * refactor: format files * refactor: use stable lists of apps and envs * refactor: fix FeatureMetrics dir name * refactor: avoid ScrollToTop on query string change * refactor: use ConditionallyRender instead of inline condition * refactor: use makeStyles instead of styled API
2022-02-21 13:47:54 +01:00
showActive?: true;
}
const StatusChip = ({ stale, showActive = true }: IStatusChip) => {
const styles = useStyles();
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;