mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-23 20:07:40 +02:00
dbed06f300
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <git@chriswk.no>
30 lines
824 B
JavaScript
30 lines
824 B
JavaScript
import React, { memo } from 'react';
|
|
import classnames from 'classnames';
|
|
import { Chip } from '@material-ui/core';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import styles from './status.module.scss';
|
|
function StatusComponent({ stale, style, showActive = true }) {
|
|
if (!stale && !showActive) {
|
|
return null;
|
|
}
|
|
|
|
const className = classnames({
|
|
[styles.stale]: stale,
|
|
[styles.active]: !stale,
|
|
});
|
|
|
|
const title = stale ? 'Feature toggle is deprecated.' : 'Feature toggle is active.';
|
|
const value = stale ? 'Stale' : 'Active';
|
|
|
|
return <Chip style={style} title={title} className={className} label={value} />;
|
|
}
|
|
|
|
export default memo(StatusComponent);
|
|
|
|
StatusComponent.propTypes = {
|
|
stale: PropTypes.bool.isRequired,
|
|
style: PropTypes.object,
|
|
showActive: PropTypes.bool,
|
|
};
|