homeflowjs 0.9.11 → 0.9.14
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/README.md +0 -3
- package/actions/properties.actions.js +5 -0
- package/actions/properties.types.js +1 -0
- package/package.json +1 -1
- package/reducers/properties.reducer.js +5 -0
- package/search/bedrooms-select/bedrooms-select.component.jsx +7 -4
- package/search/bedrooms-select/bedrooms-select.test.js +2 -2
- package/search/channel-radio-button/channel-radio-button.component.jsx +13 -5
package/README.md
CHANGED
|
@@ -56,6 +56,3 @@ success Using linked package for "react".
|
|
|
56
56
|
You may need to repeat this for `react-dom`.
|
|
57
57
|
|
|
58
58
|
This is a known issue with peer dependencies, see this comment and containing thread for more info: https://github.com/facebook/react/issues/14257#issuecomment-439967377
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Temp commit for to publish last PR to Jenkins
|
|
@@ -101,6 +101,11 @@ export const setProperties = (payload) => ({
|
|
|
101
101
|
payload,
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
export const appendProperties = (payload) => ({
|
|
105
|
+
type: PropertiesActionTypes.APPEND_PROPERTIES,
|
|
106
|
+
payload,
|
|
107
|
+
});
|
|
108
|
+
|
|
104
109
|
export const setPagination = (payload) => ({
|
|
105
110
|
type: PropertiesActionTypes.SET_PAGINATION,
|
|
106
111
|
payload,
|
package/package.json
CHANGED
|
@@ -23,6 +23,11 @@ const propertiesReducer = (state = INITIAL_STATE, action) => {
|
|
|
23
23
|
...state,
|
|
24
24
|
properties: action.payload,
|
|
25
25
|
};
|
|
26
|
+
case PropertiesActionTypes.APPEND_PROPERTIES:
|
|
27
|
+
return {
|
|
28
|
+
...state,
|
|
29
|
+
properties: state.properties ? [...state.properties, ...action.payload] : action.payload,
|
|
30
|
+
}
|
|
26
31
|
case PropertiesActionTypes.SET_PAGINATION:
|
|
27
32
|
return {
|
|
28
33
|
...state,
|
|
@@ -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 => ({
|