homeflowjs 0.9.12 → 0.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -91,6 +91,7 @@ const BedroomsSelect = (props) => {
|
|
|
91
91
|
maxBeds,
|
|
92
92
|
reactSelect,
|
|
93
93
|
bedValues,
|
|
94
|
+
allowUnderOver,
|
|
94
95
|
...otherProps
|
|
95
96
|
} = props;
|
|
96
97
|
|
|
@@ -98,12 +99,12 @@ const BedroomsSelect = (props) => {
|
|
|
98
99
|
|
|
99
100
|
let filteredBedValues = bedValues;
|
|
100
101
|
|
|
101
|
-
if (type === 'max' && minBeds) {
|
|
102
|
-
filteredBedValues = bedValues.filter(bedValue => bedValue
|
|
102
|
+
if (type === 'max' && minBeds && !allowUnderOver) {
|
|
103
|
+
filteredBedValues = bedValues.filter(bedValue => bedValue >= minBeds);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
if (type === 'min' && maxBeds) {
|
|
106
|
-
filteredBedValues = bedValues.filter(bedValue => bedValue
|
|
106
|
+
if (type === 'min' && maxBeds && !allowUnderOver) {
|
|
107
|
+
filteredBedValues = bedValues.filter(bedValue => bedValue <= maxBeds);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
if (reactSelect) {
|
|
@@ -121,12 +122,14 @@ BedroomsSelect.propTypes = {
|
|
|
121
122
|
setSearchField: PropTypes.func.isRequired,
|
|
122
123
|
optionClass: PropTypes.string,
|
|
123
124
|
placeholder: PropTypes.string,
|
|
125
|
+
allowUnderOver: PropTypes.bool,
|
|
124
126
|
};
|
|
125
127
|
|
|
126
128
|
BedroomsSelect.defaultProps = {
|
|
127
129
|
bedValues: defaultBedrooms,
|
|
128
130
|
optionClass: '',
|
|
129
131
|
placeholder: null,
|
|
132
|
+
allowUnderOver: false,
|
|
130
133
|
};
|
|
131
134
|
|
|
132
135
|
const mapStateToProps = ({ search: { currentSearch } }) => ({
|
|
@@ -50,7 +50,7 @@ describe('MinBedroomsSelect', () => {
|
|
|
50
50
|
const wrapper = mount(<BedroomsSelect {...testProps} />);
|
|
51
51
|
|
|
52
52
|
// includes the default unselected option
|
|
53
|
-
expect(wrapper.find('option').length).toEqual(
|
|
53
|
+
expect(wrapper.find('option').length).toEqual(3);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
it('removes higher beds for min when selected for max', () => {
|
|
@@ -63,6 +63,6 @@ describe('MinBedroomsSelect', () => {
|
|
|
63
63
|
const wrapper = mount(<BedroomsSelect {...testProps} />);
|
|
64
64
|
|
|
65
65
|
// includes the default unselected option
|
|
66
|
-
expect(wrapper.find('option').length).toEqual(
|
|
66
|
+
expect(wrapper.find('option').length).toEqual(4);
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -5,11 +5,11 @@ import { Radio } from 'pretty-checkbox-react';
|
|
|
5
5
|
|
|
6
6
|
import { setChannel } from '../../actions/search.actions';
|
|
7
7
|
|
|
8
|
-
const PrettyRadio = ({ channel, value,
|
|
8
|
+
const PrettyRadio = ({ channel, value, handleChange, children }) => {
|
|
9
9
|
const checked = value === channel;
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<Radio name={channel} checked={checked} onChange={
|
|
12
|
+
<Radio name={channel} value={value} checked={checked} onChange={handleChange}>
|
|
13
13
|
{children}
|
|
14
14
|
</Radio>
|
|
15
15
|
);
|
|
@@ -21,10 +21,16 @@ const ChannelRadioButton = (props) => {
|
|
|
21
21
|
value,
|
|
22
22
|
channel,
|
|
23
23
|
setChannel,
|
|
24
|
+
onChange,
|
|
24
25
|
...otherProps
|
|
25
|
-
} = props
|
|
26
|
+
} = props;
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
const handleChange = (e) => {
|
|
29
|
+
setChannel(value);
|
|
30
|
+
if (onChange) onChange(e);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (pretty) return <PrettyRadio {...props} handleChange={handleChange} />;
|
|
28
34
|
|
|
29
35
|
return (
|
|
30
36
|
<input
|
|
@@ -32,7 +38,7 @@ const ChannelRadioButton = (props) => {
|
|
|
32
38
|
name="channel"
|
|
33
39
|
aria-label={`${value}-radio`}
|
|
34
40
|
value={value}
|
|
35
|
-
onChange={
|
|
41
|
+
onChange={handleChange}
|
|
36
42
|
checked={channel === value}
|
|
37
43
|
{...otherProps}
|
|
38
44
|
/>
|
|
@@ -43,11 +49,13 @@ ChannelRadioButton.propTypes = {
|
|
|
43
49
|
value: PropTypes.oneOf(['sales', 'lettings']),
|
|
44
50
|
channel: PropTypes.string.isRequired,
|
|
45
51
|
setChannel: PropTypes.func.isRequired,
|
|
52
|
+
onChange: PropTypes.func,
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
ChannelRadioButton.defaultProps = {
|
|
49
56
|
// TODO: make this configurable via prop
|
|
50
57
|
value: 'sales',
|
|
58
|
+
onChange: null,
|
|
51
59
|
};
|
|
52
60
|
|
|
53
61
|
const mapStateToProps = state => ({
|