2020-08-11 10:58:19 +02:00
|
|
|
import React, { memo } from 'react';
|
2020-08-07 09:36:32 +02:00
|
|
|
import { Chip } from 'react-mdl';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2020-08-11 10:58:19 +02:00
|
|
|
function StatusComponent({ stale, style, showActive = true }) {
|
2020-08-07 09:36:32 +02:00
|
|
|
if (!stale && !showActive) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const className = stale
|
|
|
|
? 'mdl-color--red mdl-color-text--white mdl-shadow--2dp'
|
|
|
|
: 'mdl-color--light-green-500 mdl-color-text--white mdl-shadow--2dp';
|
|
|
|
|
|
|
|
const title = stale ? 'Feature toggle is deprecated.' : 'Feature toggle is active.';
|
|
|
|
const value = stale ? 'Stale' : 'Active';
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Chip style={style} title={title} className={className}>
|
|
|
|
{value}
|
|
|
|
</Chip>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-11 10:58:19 +02:00
|
|
|
export default memo(StatusComponent);
|
|
|
|
|
2020-08-07 09:36:32 +02:00
|
|
|
StatusComponent.propTypes = {
|
|
|
|
stale: PropTypes.bool.isRequired,
|
|
|
|
style: PropTypes.object,
|
|
|
|
showActive: PropTypes.bool,
|
|
|
|
};
|