Skip to content

Commit ec0d1b1

Browse files
committed
fix(priceRanges): fixed 'active' CSS class not using BEM
Updated doc & propTypes as well BREAKING CHANGE: the `input-group` modifier has been renamed to `form`
1 parent 7c64bae commit ec0d1b1

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Diff for: components/PriceRanges.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PriceRange extends React.Component {
2121
var key = facetValue.from + '_' + facetValue.to;
2222
return (
2323
<a
24-
className={cx(this.props.cssClasses.range, {active: facetValue.isRefined})}
24+
className={cx(this.props.cssClasses.range, {[this.props.cssClasses.active]: facetValue.isRefined})}
2525
href="#"
2626
key={key}
2727
onClick={this.refine.bind(this, facetValue.from, facetValue.to)}
@@ -57,6 +57,11 @@ class PriceRange extends React.Component {
5757

5858
PriceRange.propTypes = {
5959
cssClasses: React.PropTypes.shape({
60+
active: React.PropTypes.string,
61+
form: React.PropTypes.oneOfType([
62+
React.PropTypes.string,
63+
React.PropTypes.arrayOf(React.PropTypes.string)
64+
]),
6065
range: React.PropTypes.oneOfType([
6166
React.PropTypes.string,
6267
React.PropTypes.arrayOf(React.PropTypes.string)

Diff for: widgets/price-ranges/__tests__/price-ranges-test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ describe('priceRanges()', () => {
6262

6363
props = {
6464
cssClasses: {
65+
active: 'ais-price-ranges--range__active',
6566
body: 'ais-price-ranges--body',
6667
button: 'ais-price-ranges--button',
6768
footer: 'ais-price-ranges--footer',
6869
header: 'ais-price-ranges--header',
6970
input: 'ais-price-ranges--input',
70-
form: 'ais-price-ranges--input-group',
71+
form: 'ais-price-ranges--form',
7172
range: 'ais-price-ranges--range',
7273
root: 'ais-price-ranges'
7374
},

Diff for: widgets/price-ranges/price-ranges.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ var cx = require('classnames/dedupe');
2121
* @param {String|String[]} [options.cssClasses.header] CSS class to add to the header element
2222
* @param {String|String[]} [options.cssClasses.body] CSS class to add to the body element
2323
* @param {String|String[]} [options.cssClasses.footer] CSS class to add to the footer element
24+
* @param {String|String[]} [options.cssClasses.form] CSS class to add to the form element
2425
* @param {String|String[]} [options.cssClasses.range] CSS class to add to the range element
26+
* @param {String|String[]} [options.cssClasses.active] CSS class to add to the active range element
2527
* @param {String|String[]} [options.cssClasses.input] CSS class to add to the min/max input elements
2628
* @param {String|String[]} [options.cssClasses.button] CSS class to add to the button element
2729
* @param {Object} [options.templates] Templates to use for the widget
@@ -123,8 +125,9 @@ function priceRanges({
123125
body: cx(bem('body'), cssClasses.body),
124126
footer: cx(bem('footer'), cssClasses.footer),
125127
range: cx(bem('range'), cssClasses.range),
128+
active: cx(bem('range', 'active'), cssClasses.active),
126129
input: cx(bem('input'), cssClasses.input),
127-
form: cx(bem('input-group'), cssClasses.form),
130+
form: cx(bem('form'), cssClasses.form),
128131
button: cx(bem('button'), cssClasses.button)
129132
};
130133

0 commit comments

Comments
 (0)