homeflowjs 0.8.1 → 0.8.2
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
|
@@ -10,7 +10,12 @@ const ConditionalWrapper = ({ condition, wrapper, children }) => (
|
|
|
10
10
|
);
|
|
11
11
|
|
|
12
12
|
const PropertiesDisplay = ({
|
|
13
|
-
properties,
|
|
13
|
+
properties,
|
|
14
|
+
Item,
|
|
15
|
+
displayType,
|
|
16
|
+
infiniteScroll,
|
|
17
|
+
inserts,
|
|
18
|
+
...other
|
|
14
19
|
}) => {
|
|
15
20
|
const onScroll = () => {
|
|
16
21
|
handleScroll(infiniteScroll);
|
|
@@ -44,9 +49,23 @@ const PropertiesDisplay = ({
|
|
|
44
49
|
</div>
|
|
45
50
|
)}
|
|
46
51
|
>
|
|
47
|
-
{page.map((property) =>
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
{page.map((property, index) => {
|
|
53
|
+
/**
|
|
54
|
+
* TODO: Allow for multiple inserts
|
|
55
|
+
* This code only allows one insert from the inserts array to be show at a time
|
|
56
|
+
*/
|
|
57
|
+
if (inserts && (index % inserts[0].frequency) === 0 && index !== 0) {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
60
|
+
{inserts[0].component}
|
|
61
|
+
<Item key={property.property_id} property={property} {...other} />
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return (
|
|
66
|
+
<Item key={property.property_id} property={property} {...other} />
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
50
69
|
</ConditionalWrapper>
|
|
51
70
|
));
|
|
52
71
|
|
|
@@ -62,6 +81,11 @@ PropertiesDisplay.propTypes = {
|
|
|
62
81
|
Item: PropTypes.elementType.isRequired,
|
|
63
82
|
displayType: PropTypes.string.isRequired,
|
|
64
83
|
infiniteScroll: PropTypes.bool.isRequired,
|
|
84
|
+
inserts: PropTypes.array,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
PropertiesDisplay.defaultProps = {
|
|
88
|
+
inserts: null,
|
|
65
89
|
};
|
|
66
90
|
|
|
67
91
|
const mapStateToProps = (state) => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import PropertiesDisplay from '../properties-display/properties-display.component'
|
|
4
|
+
import PropertiesDisplay from '../properties-display/properties-display.component';
|
|
5
5
|
|
|
6
|
-
const PropertiesGrid = ({ GridItem, ...other}) => (
|
|
6
|
+
const PropertiesGrid = ({ GridItem, ...other }) => (
|
|
7
7
|
<PropertiesDisplay
|
|
8
8
|
Item={GridItem}
|
|
9
9
|
displayType="grid"
|
|
@@ -25,21 +25,40 @@ const PropertyResults = ({
|
|
|
25
25
|
defaultView,
|
|
26
26
|
infiniteScroll,
|
|
27
27
|
noMap,
|
|
28
|
+
inserts,
|
|
28
29
|
...other
|
|
29
30
|
}) => (
|
|
30
31
|
<Router>
|
|
31
32
|
<Switch>
|
|
32
33
|
<Route path="/list">
|
|
33
|
-
<PropertiesDisplay
|
|
34
|
+
<PropertiesDisplay
|
|
35
|
+
Item={ListItem}
|
|
36
|
+
displayType="list"
|
|
37
|
+
infiniteScroll={infiniteScroll}
|
|
38
|
+
inserts={inserts}
|
|
39
|
+
{...other}
|
|
40
|
+
/>
|
|
34
41
|
</Route>
|
|
35
42
|
|
|
36
43
|
<Route path="/grid">
|
|
37
|
-
<PropertiesDisplay
|
|
44
|
+
<PropertiesDisplay
|
|
45
|
+
Item={GridItem}
|
|
46
|
+
displayType="grid"
|
|
47
|
+
infiniteScroll={infiniteScroll}
|
|
48
|
+
inserts={inserts}
|
|
49
|
+
{...other}
|
|
50
|
+
/>
|
|
38
51
|
</Route>
|
|
39
52
|
|
|
40
53
|
<Route path="/map">
|
|
41
54
|
{noMap ? (
|
|
42
|
-
<PropertiesDisplay
|
|
55
|
+
<PropertiesDisplay
|
|
56
|
+
Item={MapItem}
|
|
57
|
+
displayType="map"
|
|
58
|
+
infiniteScroll={infiniteScroll}
|
|
59
|
+
inserts={inserts}
|
|
60
|
+
{...other}
|
|
61
|
+
/>
|
|
43
62
|
) : (
|
|
44
63
|
<LazyPropertiesMap />
|
|
45
64
|
)}
|
|
@@ -47,11 +66,23 @@ const PropertyResults = ({
|
|
|
47
66
|
|
|
48
67
|
{defaultView === 'grid' ? (
|
|
49
68
|
<Route>
|
|
50
|
-
<PropertiesDisplay
|
|
69
|
+
<PropertiesDisplay
|
|
70
|
+
Item={GridItem}
|
|
71
|
+
displayType="grid"
|
|
72
|
+
infiniteScroll={infiniteScroll}
|
|
73
|
+
inserts={inserts}
|
|
74
|
+
{...other}
|
|
75
|
+
/>
|
|
51
76
|
</Route>
|
|
52
77
|
) : (
|
|
53
78
|
<Route>
|
|
54
|
-
<PropertiesDisplay
|
|
79
|
+
<PropertiesDisplay
|
|
80
|
+
Item={ListItem}
|
|
81
|
+
displayType="list"
|
|
82
|
+
infiniteScroll={infiniteScroll}
|
|
83
|
+
inserts={inserts}
|
|
84
|
+
{...other}
|
|
85
|
+
/>
|
|
55
86
|
</Route>
|
|
56
87
|
)}
|
|
57
88
|
</Switch>
|
|
@@ -65,6 +96,7 @@ PropertyResults.propTypes = {
|
|
|
65
96
|
defaultView: PropTypes.string,
|
|
66
97
|
infiniteScroll: PropTypes.bool,
|
|
67
98
|
noMap: PropTypes.bool,
|
|
99
|
+
inserts: PropTypes.array,
|
|
68
100
|
};
|
|
69
101
|
|
|
70
102
|
PropertyResults.defaultProps = {
|
|
@@ -74,6 +106,7 @@ PropertyResults.defaultProps = {
|
|
|
74
106
|
defaultView: 'list',
|
|
75
107
|
infiniteScroll: false,
|
|
76
108
|
noMap: false,
|
|
109
|
+
inserts: null,
|
|
77
110
|
};
|
|
78
111
|
|
|
79
112
|
export default PropertyResults;
|