homeflowjs 0.9.13 → 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/package.json
CHANGED
|
@@ -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 => ({
|