Add optional heading to thresholds list

pull/2993/head
Alex P 2018-03-14 20:44:39 -07:00
parent cf5bb6c8d3
commit fe3152ae6a
1 changed files with 7 additions and 2 deletions

View File

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