You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
751 B
37 lines
751 B
import classNames from 'classnames';
|
|
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import titleCase from 'Utilities/String/titleCase';
|
|
import styles from './LegendItem.css';
|
|
|
|
function LegendItem(props) {
|
|
const {
|
|
name,
|
|
status,
|
|
tooltip,
|
|
colorImpairedMode
|
|
} = props;
|
|
|
|
return (
|
|
<div
|
|
className={classNames(
|
|
styles.legendItem,
|
|
styles[status],
|
|
colorImpairedMode && 'colorImpaired'
|
|
)}
|
|
title={tooltip}
|
|
>
|
|
{name ? name : titleCase(status)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
LegendItem.propTypes = {
|
|
name: PropTypes.string,
|
|
status: PropTypes.string.isRequired,
|
|
tooltip: PropTypes.string.isRequired,
|
|
colorImpairedMode: PropTypes.bool.isRequired
|
|
};
|
|
|
|
export default LegendItem;
|