@abcagency/hc-ui-components 1.3.46 → 1.3.48
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/dist/components/HireControlMap.js +1 -0
- package/dist/components/HireControlMap.js.map +1 -1
- package/dist/components/containers/accordions/filter-item-container.js +1 -0
- package/dist/components/containers/accordions/filter-item-container.js.map +1 -1
- package/dist/components/containers/filter/filter-item-container.js +3 -0
- package/dist/components/containers/filter/filter-item-container.js.map +1 -1
- package/dist/components/containers/maps/info-window-content-container.js +3 -3
- package/dist/components/containers/maps/info-window-content-container.js.map +1 -1
- package/dist/components/containers/maps/map-container.js +34 -2
- package/dist/components/containers/maps/map-container.js.map +1 -1
- package/dist/components/containers/maps/map-list-container.js +4 -2
- package/dist/components/containers/maps/map-list-container.js.map +1 -1
- package/dist/components/modules/buttons/show-all-button.js +1 -2
- package/dist/components/modules/buttons/show-all-button.js.map +1 -1
- package/dist/components/modules/filter/location.js +3 -0
- package/dist/components/modules/filter/location.js.map +1 -1
- package/dist/components/modules/maps/map-list.js +3 -2
- package/dist/components/modules/maps/map-list.js.map +1 -1
- package/dist/components/modules/maps/map.js.map +1 -1
- package/dist/util/filterUtil.js +16 -0
- package/dist/util/filterUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/components/HireControlMap.js +1 -0
- package/src/components/containers/accordions/filter-item-container.js +1 -0
- package/src/components/containers/filter/filter-item-container.js +80 -77
- package/src/components/containers/maps/info-window-content-container.js +2 -2
- package/src/components/containers/maps/map-container.js +245 -206
- package/src/components/containers/maps/map-list-container.js +3 -1
- package/src/components/modules/buttons/show-all-button.js +2 -3
- package/src/components/modules/filter/location.js +7 -4
- package/src/components/modules/maps/map-list.js +13 -3
- package/src/components/modules/maps/map.js +64 -64
- package/src/util/filterUtil.js +17 -0
|
@@ -1,206 +1,245 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import MapMarker from "~/components/containers/maps/map-marker-container";
|
|
4
|
-
import PlaceMarker from "~/components/modules/maps/place-marker";
|
|
5
|
-
|
|
6
|
-
import { usePlaces } from "~/contexts/placesContext";
|
|
7
|
-
import { useMap } from "~/contexts/mapContext";
|
|
8
|
-
import { useMapList } from "~/contexts/mapListContext";
|
|
9
|
-
|
|
10
|
-
import { markerIconSelected, markerIcon, pinIcon } from "~/util/mapIconUtil";
|
|
11
|
-
|
|
12
|
-
import Map from "~/components/modules/maps/map";
|
|
13
|
-
import { MarkerClustererF } from "@react-google-maps/api";
|
|
14
|
-
import { clusterOptions } from "~/util/mapUtil";
|
|
15
|
-
|
|
16
|
-
const MapContainer = ({
|
|
17
|
-
markerConfigs,
|
|
18
|
-
infoWindowClasses,
|
|
19
|
-
clusterGridSize = 60
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
location,
|
|
23
|
-
zoom,
|
|
24
|
-
center,
|
|
25
|
-
selectLocationEntity,
|
|
26
|
-
setLocation,
|
|
27
|
-
mapInteracted,
|
|
28
|
-
setMapInteracted
|
|
29
|
-
} = useMap();
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
mapItems, filteredListings, setSelectedFilters,
|
|
33
|
-
setQuery
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
mapContainerRef.current
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
google.maps.event.removeListener(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
mapRef.current
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
141
|
-
mapRef.current
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import MapMarker from "~/components/containers/maps/map-marker-container";
|
|
4
|
+
import PlaceMarker from "~/components/modules/maps/place-marker";
|
|
5
|
+
|
|
6
|
+
import { usePlaces } from "~/contexts/placesContext";
|
|
7
|
+
import { useMap } from "~/contexts/mapContext";
|
|
8
|
+
import { useMapList } from "~/contexts/mapListContext";
|
|
9
|
+
|
|
10
|
+
import { markerIconSelected, markerIcon, pinIcon } from "~/util/mapIconUtil";
|
|
11
|
+
|
|
12
|
+
import Map from "~/components/modules/maps/map";
|
|
13
|
+
import { MarkerClustererF } from "@react-google-maps/api";
|
|
14
|
+
import { clusterOptions } from "~/util/mapUtil";
|
|
15
|
+
|
|
16
|
+
const MapContainer = ({
|
|
17
|
+
markerConfigs,
|
|
18
|
+
infoWindowClasses,
|
|
19
|
+
clusterGridSize = 60
|
|
20
|
+
}) => {
|
|
21
|
+
const {
|
|
22
|
+
location,
|
|
23
|
+
zoom,
|
|
24
|
+
center,
|
|
25
|
+
selectLocationEntity,
|
|
26
|
+
setLocation,
|
|
27
|
+
mapInteracted,
|
|
28
|
+
setMapInteracted
|
|
29
|
+
} = useMap();
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
mapItems, filteredListings, setSelectedFilters,
|
|
33
|
+
setQuery,
|
|
34
|
+
siteConfig
|
|
35
|
+
} = useMapList();
|
|
36
|
+
|
|
37
|
+
const mapRef = useRef();
|
|
38
|
+
const markerRefs = useRef({});
|
|
39
|
+
const mapContainerRef = useRef(null);
|
|
40
|
+
const {
|
|
41
|
+
poiMarkers,
|
|
42
|
+
setCurrentCenter,
|
|
43
|
+
currentCenter,
|
|
44
|
+
setCurrentZoom,
|
|
45
|
+
currentZoom,
|
|
46
|
+
selectedPlaceMarker,
|
|
47
|
+
setSelectedPlaceMarker,
|
|
48
|
+
placesWindow,
|
|
49
|
+
setPlacesWindow } = usePlaces();
|
|
50
|
+
|
|
51
|
+
const onIdle = () => {
|
|
52
|
+
if (!currentCenter || !mapRef.current) return;
|
|
53
|
+
const newCenter = mapRef.current.getCenter().toJSON();
|
|
54
|
+
const newZoom = mapRef.current.zoom;
|
|
55
|
+
|
|
56
|
+
setCurrentCenter(newCenter);
|
|
57
|
+
|
|
58
|
+
if (newZoom !== currentZoom) {
|
|
59
|
+
setCurrentZoom(newZoom);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (mapContainerRef.current) {
|
|
65
|
+
const handleScroll = () => {
|
|
66
|
+
setMapInteracted(true);
|
|
67
|
+
};
|
|
68
|
+
var mapContainerRefCurrent = mapContainerRef.current;
|
|
69
|
+
mapContainerRef.current.addEventListener('wheel', handleScroll);
|
|
70
|
+
return () => mapContainerRefCurrent.removeEventListener('wheel', handleScroll);
|
|
71
|
+
}
|
|
72
|
+
}, [mapContainerRef.current]);
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (mapRef.current) {
|
|
76
|
+
const mapInstance = mapRef.current;
|
|
77
|
+
const dragStartListener = mapInstance.addListener('dragstart', () => setMapInteracted(true));
|
|
78
|
+
const mouseDownListener = mapInstance.addListener('mousedown', () => setMapInteracted(true));
|
|
79
|
+
return () => {
|
|
80
|
+
google.maps.event.removeListener(dragStartListener);
|
|
81
|
+
google.maps.event.removeListener(mouseDownListener);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}, [mapRef.current, mapContainerRef.current]);
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current) {
|
|
88
|
+
fitBounds(mapRef.current);
|
|
89
|
+
}
|
|
90
|
+
}, [mapItems, mapRef.current, location]);
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if ((mapItems && mapItems.length > 0 || poiMarkers.length > 0) && mapRef.current && mapInteracted) {
|
|
94
|
+
fitBounds(mapRef.current, true);
|
|
95
|
+
}
|
|
96
|
+
if (mapRef.current) {
|
|
97
|
+
let currZoom = mapRef.current.zoom;
|
|
98
|
+
let setZoomVal = currZoom < 13 ? currZoom : 12;
|
|
99
|
+
mapRef.current.setZoom(setZoomVal);
|
|
100
|
+
}
|
|
101
|
+
}, [filteredListings]);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!mapRef.current || !location || mapInteracted) return;
|
|
105
|
+
mapRef.current.panTo(
|
|
106
|
+
new google.maps.LatLng(location.latitude, location.longitude)
|
|
107
|
+
);
|
|
108
|
+
if (mapRef.current) {
|
|
109
|
+
let setZoomVal = zoom < 13 ? zoom : 12;
|
|
110
|
+
mapRef.current.setZoom(setZoomVal);
|
|
111
|
+
}
|
|
112
|
+
}, [location, zoom, mapRef.current]);
|
|
113
|
+
|
|
114
|
+
const fitBounds = (map, overload = false) => {
|
|
115
|
+
if ((mapInteracted === false || overload) && mapItems != null) {
|
|
116
|
+
const bounds = new window.google.maps.LatLngBounds();
|
|
117
|
+
mapItems.forEach(item => {
|
|
118
|
+
bounds.extend(new google.maps.LatLng(item.latitude, item.longitude));
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (!map) return;
|
|
122
|
+
const currentCenter = map.getCenter();
|
|
123
|
+
map.fitBounds(bounds);
|
|
124
|
+
const newCenter = bounds.getCenter();
|
|
125
|
+
if (currentCenter && newCenter) {
|
|
126
|
+
map.panTo(newCenter);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (mapRef.current.zoom > 17) {
|
|
130
|
+
mapRef.current.setZoom(16);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const markerClickHandler = mapLocation => {
|
|
135
|
+
setMapInteracted(true);
|
|
136
|
+
selectLocationEntity(mapLocation);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const onLoad = map => {
|
|
140
|
+
if (!location || location === null) {
|
|
141
|
+
mapRef.current = map;
|
|
142
|
+
fitBounds(map, true);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
mapRef.current = map;
|
|
146
|
+
|
|
147
|
+
if (mapInteracted === false) {
|
|
148
|
+
mapRef.current.panTo(
|
|
149
|
+
new google.maps.LatLng(location.latitude, location.longitude)
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
mapRef.current.setZoom(zoom);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const pinIconUrl = pinIcon({
|
|
157
|
+
fillColor: markerConfigs.fillColor,
|
|
158
|
+
strokeColor: markerConfigs.strokeColor
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const onClusterClick = cluster => {
|
|
162
|
+
if(!siteConfig.optionalShowLocationClusterConfig || (mapRef.current.zoom > siteConfig.optionalShowLocationClusterConfig.showForZoomLevelLessThan)) {
|
|
163
|
+
console.log("should return");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (!cluster || typeof cluster.getMarkers !== 'function') {
|
|
167
|
+
console.error('Cluster object or getMarkers method not available.');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const markers = cluster.getMarkers();
|
|
172
|
+
|
|
173
|
+
if (!markers || markers.length === 0) {
|
|
174
|
+
console.error('No markers found in the cluster.');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
const bounds = new window.google.maps.LatLngBounds();
|
|
180
|
+
|
|
181
|
+
markers.forEach(marker => {
|
|
182
|
+
bounds.extend(marker.getPosition());
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
bounds.extend(new google.maps.LatLng(siteConfig.optionalShowLocationClusterConfig.latitude, siteConfig.optionalShowLocationClusterConfig.longitude));
|
|
186
|
+
|
|
187
|
+
if (mapRef.current) {
|
|
188
|
+
mapRef.current.fitBounds(bounds);
|
|
189
|
+
}
|
|
190
|
+
}, 500);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<Map
|
|
195
|
+
zoom={zoom}
|
|
196
|
+
center={center}
|
|
197
|
+
mapContainerRef={mapContainerRef}
|
|
198
|
+
onLoad={onLoad}
|
|
199
|
+
onIdle={onIdle}
|
|
200
|
+
mapInteracted={mapInteracted}
|
|
201
|
+
pinIconUrl={pinIconUrl}
|
|
202
|
+
setMapInteracted={setMapInteracted}
|
|
203
|
+
fitBounds={fitBounds}
|
|
204
|
+
mapRef={mapRef}
|
|
205
|
+
setQuery={setQuery}
|
|
206
|
+
filteredListingsLength={filteredListings.length}
|
|
207
|
+
setSelectedFilters={setSelectedFilters}
|
|
208
|
+
>
|
|
209
|
+
<MarkerClustererF options={clusterOptions(clusterGridSize, markerConfigs.fillColor)} onClick={onClusterClick}>
|
|
210
|
+
{clusterer => (
|
|
211
|
+
<>
|
|
212
|
+
{mapItems.map(item => (
|
|
213
|
+
<MapMarker
|
|
214
|
+
key={item.id}
|
|
215
|
+
item={item}
|
|
216
|
+
selectedLocation={location}
|
|
217
|
+
markerRefs={markerRefs}
|
|
218
|
+
infoWindowClasses={infoWindowClasses}
|
|
219
|
+
setSelectedLocation={setLocation}
|
|
220
|
+
markerClickHandler={markerClickHandler}
|
|
221
|
+
clusterer={clusterer}
|
|
222
|
+
markerIcon={markerIcon(markerConfigs)}
|
|
223
|
+
markerIconSelected={markerIconSelected(markerConfigs)}
|
|
224
|
+
setMapInteracted={setMapInteracted}
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
227
|
+
{poiMarkers && poiMarkers.markers.map((marker, index) => (
|
|
228
|
+
<PlaceMarker
|
|
229
|
+
key={`marker-${marker.title}-${index}`}
|
|
230
|
+
marker={marker}
|
|
231
|
+
index={index}
|
|
232
|
+
selectedPlaceMarker={selectedPlaceMarker}
|
|
233
|
+
placesWindow={placesWindow}
|
|
234
|
+
setPlacesWindow={setPlacesWindow}
|
|
235
|
+
setSelectedPlaceMarker={setSelectedPlaceMarker}
|
|
236
|
+
/>
|
|
237
|
+
))}
|
|
238
|
+
</>
|
|
239
|
+
)}
|
|
240
|
+
</MarkerClustererF>
|
|
241
|
+
</Map>
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export default MapContainer;
|
|
@@ -14,7 +14,8 @@ const MapListContainer = ({
|
|
|
14
14
|
specialFeatures,
|
|
15
15
|
fieldNames,
|
|
16
16
|
showMap,
|
|
17
|
-
placeMappings
|
|
17
|
+
placeMappings,
|
|
18
|
+
mapPosition
|
|
18
19
|
}) => {
|
|
19
20
|
|
|
20
21
|
const listProps = {
|
|
@@ -41,6 +42,7 @@ const MapListContainer = ({
|
|
|
41
42
|
list={<List {...listProps} />}
|
|
42
43
|
map={<Map {...mapProps} />}
|
|
43
44
|
filter={<Filter showMap={showMap} className="md:hc-hidden" />}
|
|
45
|
+
mapPosition={mapPosition}
|
|
44
46
|
/>
|
|
45
47
|
);
|
|
46
48
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
const ShowAllButton = ({ mapInteracted,
|
|
4
|
-
if (!mapInteracted
|
|
3
|
+
const ShowAllButton = ({ mapInteracted, setMapInteracted, fitBounds, mapRef, pinIconUrl, setSelectedFilters, setQuery, listingCount }) => {
|
|
4
|
+
if (!mapInteracted) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
return (
|
|
9
8
|
<button
|
|
10
9
|
style={{ fontFamily: 'Roboto, Arial, sans-serif', fontSize: '14px', fontWeight: '500' }}
|
|
@@ -25,8 +25,11 @@ const FilterLocation = ({
|
|
|
25
25
|
{!locations && <Loading />}
|
|
26
26
|
{locations && (
|
|
27
27
|
<Accordion defaultValue={defaultValue} className="hc-space-y-4">
|
|
28
|
-
{locations?.map(filter =>
|
|
29
|
-
|
|
28
|
+
{locations?.map(filter => {
|
|
29
|
+
if(filter.id === 'entityName' && (!selectedFilters.cityState && !selectedFilters.state)){
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
return(<AccordionFilterItem
|
|
30
33
|
key={filter.id}
|
|
31
34
|
filter={filter}
|
|
32
35
|
setDefaultValue={setDefaultValue}
|
|
@@ -36,8 +39,8 @@ const FilterLocation = ({
|
|
|
36
39
|
setLocation(null);
|
|
37
40
|
setSelectedListItem(null);
|
|
38
41
|
}}
|
|
39
|
-
/>
|
|
40
|
-
)
|
|
42
|
+
/>);
|
|
43
|
+
})}
|
|
41
44
|
{children}
|
|
42
45
|
</Accordion>
|
|
43
46
|
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Tabs from '~/components/modules/maps/tabs';
|
|
3
3
|
|
|
4
|
-
const MapList = ({ showMap, loading, list, map, filter }) => {
|
|
4
|
+
const MapList = ({ showMap, loading, list, map, filter, mapPosition }) => {
|
|
5
5
|
return (
|
|
6
6
|
<>
|
|
7
7
|
<div
|
|
@@ -10,8 +10,18 @@ const MapList = ({ showMap, loading, list, map, filter }) => {
|
|
|
10
10
|
md:hc-grid md:hc-pt-4 hc-overflow-hidden hc-relative bg-gray-100
|
|
11
11
|
`}
|
|
12
12
|
>
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
{mapPosition && mapPosition === 'top' && showMap ? (
|
|
14
|
+
<>
|
|
15
|
+
<div>{map}</div>
|
|
16
|
+
<div>{list}</div>
|
|
17
|
+
</>
|
|
18
|
+
) : (
|
|
19
|
+
<>
|
|
20
|
+
<div>{list}</div>
|
|
21
|
+
<div>{showMap && map}</div>
|
|
22
|
+
</>
|
|
23
|
+
)}
|
|
24
|
+
|
|
15
25
|
</div>
|
|
16
26
|
<div className="md:hc-hidden">
|
|
17
27
|
<Tabs
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { GoogleMap } from "@react-google-maps/api";
|
|
3
|
-
import ShowAllButton from "~/components/modules/buttons/show-all-button";
|
|
4
|
-
|
|
5
|
-
const Map = ({
|
|
6
|
-
zoom,
|
|
7
|
-
center,
|
|
8
|
-
mapContainerRef,
|
|
9
|
-
onLoad,
|
|
10
|
-
onIdle,
|
|
11
|
-
mapInteracted,
|
|
12
|
-
pinIconUrl,
|
|
13
|
-
setMapInteracted,
|
|
14
|
-
fitBounds,
|
|
15
|
-
mapRef,
|
|
16
|
-
setQuery,
|
|
17
|
-
filteredListingsLength,
|
|
18
|
-
setSelectedFilters,
|
|
19
|
-
children
|
|
20
|
-
}) => {
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
{zoom && center && (
|
|
24
|
-
<div ref={mapContainerRef} className="hc-h-full hc-relative">
|
|
25
|
-
<GoogleMap
|
|
26
|
-
zoom={zoom}
|
|
27
|
-
onLoad={onLoad}
|
|
28
|
-
onIdle={onIdle}
|
|
29
|
-
center={center}
|
|
30
|
-
mapContainerStyle={{
|
|
31
|
-
width: "100%",
|
|
32
|
-
height: "100%"
|
|
33
|
-
}}
|
|
34
|
-
options={{
|
|
35
|
-
styles: [
|
|
36
|
-
{
|
|
37
|
-
featureType: "poi",
|
|
38
|
-
elementType: "labels",
|
|
39
|
-
stylers: [{ visibility: "off" }]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</GoogleMap>
|
|
46
|
-
{mapInteracted && (
|
|
47
|
-
<ShowAllButton
|
|
48
|
-
mapInteracted={mapInteracted}
|
|
49
|
-
setMapInteracted={setMapInteracted}
|
|
50
|
-
fitBounds={fitBounds}
|
|
51
|
-
mapRef={mapRef}
|
|
52
|
-
pinIconUrl={pinIconUrl}
|
|
53
|
-
setQuery={setQuery}
|
|
54
|
-
listingCount={filteredListingsLength}
|
|
55
|
-
setSelectedFilters={setSelectedFilters}
|
|
56
|
-
/>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
</>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default Map;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GoogleMap } from "@react-google-maps/api";
|
|
3
|
+
import ShowAllButton from "~/components/modules/buttons/show-all-button";
|
|
4
|
+
|
|
5
|
+
const Map = ({
|
|
6
|
+
zoom,
|
|
7
|
+
center,
|
|
8
|
+
mapContainerRef,
|
|
9
|
+
onLoad,
|
|
10
|
+
onIdle,
|
|
11
|
+
mapInteracted,
|
|
12
|
+
pinIconUrl,
|
|
13
|
+
setMapInteracted,
|
|
14
|
+
fitBounds,
|
|
15
|
+
mapRef,
|
|
16
|
+
setQuery,
|
|
17
|
+
filteredListingsLength,
|
|
18
|
+
setSelectedFilters,
|
|
19
|
+
children
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
{zoom && center && (
|
|
24
|
+
<div ref={mapContainerRef} className="hc-h-full hc-relative">
|
|
25
|
+
<GoogleMap
|
|
26
|
+
zoom={zoom}
|
|
27
|
+
onLoad={onLoad}
|
|
28
|
+
onIdle={onIdle}
|
|
29
|
+
center={center}
|
|
30
|
+
mapContainerStyle={{
|
|
31
|
+
width: "100%",
|
|
32
|
+
height: "100%"
|
|
33
|
+
}}
|
|
34
|
+
options={{
|
|
35
|
+
styles: [
|
|
36
|
+
{
|
|
37
|
+
featureType: "poi",
|
|
38
|
+
elementType: "labels",
|
|
39
|
+
stylers: [{ visibility: "off" }]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</GoogleMap>
|
|
46
|
+
{mapInteracted && (
|
|
47
|
+
<ShowAllButton
|
|
48
|
+
mapInteracted={mapInteracted}
|
|
49
|
+
setMapInteracted={setMapInteracted}
|
|
50
|
+
fitBounds={fitBounds}
|
|
51
|
+
mapRef={mapRef}
|
|
52
|
+
pinIconUrl={pinIconUrl}
|
|
53
|
+
setQuery={setQuery}
|
|
54
|
+
listingCount={filteredListingsLength}
|
|
55
|
+
setSelectedFilters={setSelectedFilters}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default Map;
|