1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/feature/status-component.jsx

31 lines
836 B
React
Raw Normal View History

import React, { memo } from 'react';
import { Chip } from 'react-mdl';
import PropTypes from 'prop-types';
function StatusComponent({ stale, style, showActive = true }) {
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>
);
}
export default memo(StatusComponent);
StatusComponent.propTypes = {
stale: PropTypes.bool.isRequired,
style: PropTypes.object,
showActive: PropTypes.bool,
};