Add optional heading to thresholds list

pull/10616/head
Alex P 2018-03-14 20:44:39 -07:00
parent 0678e6de25
commit dc1d51a524
1 changed files with 7 additions and 2 deletions

View File

@ -112,11 +112,12 @@ class ThresholdsList extends Component {
} }
render() { render() {
const {singleStatColors} = this.props const {singleStatColors, showListHeading} = this.props
const disableAddThreshold = singleStatColors.length > MAX_THRESHOLDS const disableAddThreshold = singleStatColors.length > MAX_THRESHOLDS
return ( return (
<div className="thresholds-list"> <div className="thresholds-list">
{showListHeading && <label className="form-label">Thresholds</label>}
<button <button
className="btn btn-sm btn-primary" className="btn btn-sm btn-primary"
onClick={this.handleAddThreshold} onClick={this.handleAddThreshold}
@ -151,8 +152,11 @@ class ThresholdsList extends Component {
) )
} }
} }
const {arrayOf, func, number, shape, string} = PropTypes const {arrayOf, bool, func, number, shape, string} = PropTypes
ThresholdsList.defaultProps = {
showListHeading: false,
}
ThresholdsList.propTypes = { ThresholdsList.propTypes = {
singleStatType: string.isRequired, singleStatType: string.isRequired,
singleStatColors: arrayOf( singleStatColors: arrayOf(
@ -166,6 +170,7 @@ ThresholdsList.propTypes = {
), ),
handleUpdateSingleStatColors: func.isRequired, handleUpdateSingleStatColors: func.isRequired,
onResetFocus: func.isRequired, onResetFocus: func.isRequired,
showListHeading: bool,
} }
const mapStateToProps = ({ const mapStateToProps = ({