@woosmap/ui 2.35.0 → 2.39.0
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 +2 -1
- package/src/Constants.js +1 -0
- package/src/components/Button/Button.stories.js +1 -1
- package/src/components/Button/ButtonSwitch.js +1 -1
- package/src/components/Card/Card.stories.js +1 -1
- package/src/components/Card/SimpleCard.js +9 -1
- package/src/components/Card/SimpleCard.styl +9 -2
- package/src/components/Demo/DistanceDemo.js +87 -62
- package/src/components/Demo/GeolocationDemo.js +124 -48
- package/src/components/Demo/LocalitiesAddressDemo.js +63 -54
- package/src/components/Demo/LocalitiesDemo.js +61 -46
- package/src/components/Demo/SearchDemo.js +85 -93
- package/src/components/Label/Label.styl +9 -1
- package/src/components/Map/Marker.js +2 -2
- package/src/components/Map/Marker.test.js +2 -2
- package/src/components/Map/drawOnMap.js +67 -0
- package/src/components/Map/marker.styl +1 -1
- package/src/locales/en/translation.json +2 -1
- package/src/locales/fr/translation.json +3 -2
- package/src/styles/console/button.styl +24 -1
- package/src/styles/console/colors.styl +2 -0
- package/src/styles/console/mixins.styl +1 -1
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import GoogleMapReact from 'google-map-react';
|
|
6
5
|
import Demo from './SkeletonDemo';
|
|
7
6
|
import AddressAutocomplete from '../Woosmap/AddressAutocomplete';
|
|
8
|
-
import Marker from '../Map/Marker';
|
|
9
7
|
import Constants from '../../Constants';
|
|
10
|
-
import { viewpoint } from '../Map/drawOnMap';
|
|
11
8
|
import CountrySelect from '../Select/CountrySelect';
|
|
12
9
|
import { tr } from '../utils/locale';
|
|
13
10
|
import Input from '../Input/Input';
|
|
11
|
+
import markerIcon from '../../images/marker.png';
|
|
12
|
+
import Script from '../utils/Script';
|
|
14
13
|
|
|
15
14
|
export default class LocalitiesAddressDemo extends Component {
|
|
16
15
|
constructor(props) {
|
|
@@ -31,6 +30,11 @@ export default class LocalitiesAddressDemo extends Component {
|
|
|
31
30
|
this.requestDetailsUrl = 'https://api.woosmap.com/localities/details';
|
|
32
31
|
this.inputRef = React.createRef();
|
|
33
32
|
this.addressAutocompleteRef = React.createRef();
|
|
33
|
+
this.mapDivRef = React.createRef();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
componentDidMount() {
|
|
37
|
+
this.displayMap();
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
componentWillUnmount() {
|
|
@@ -83,12 +87,15 @@ export default class LocalitiesAddressDemo extends Component {
|
|
|
83
87
|
})
|
|
84
88
|
.then((response) => {
|
|
85
89
|
if (this.mounted) {
|
|
86
|
-
this.setState(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
this.setState(
|
|
91
|
+
{
|
|
92
|
+
error: null,
|
|
93
|
+
showDetails: true,
|
|
94
|
+
response: response.data.result,
|
|
95
|
+
selectedLocality: response.data.result,
|
|
96
|
+
},
|
|
97
|
+
this.displayOnMap
|
|
98
|
+
);
|
|
92
99
|
}
|
|
93
100
|
})
|
|
94
101
|
.catch((error) => {
|
|
@@ -124,14 +131,23 @@ export default class LocalitiesAddressDemo extends Component {
|
|
|
124
131
|
};
|
|
125
132
|
|
|
126
133
|
displayOnMap = () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
134
|
+
if (this.map) {
|
|
135
|
+
const { selectedLocality } = this.state;
|
|
136
|
+
|
|
137
|
+
if (selectedLocality?.geometry?.location) {
|
|
138
|
+
this.map.setCenter(selectedLocality.geometry.location);
|
|
139
|
+
this.map.setZoom(17);
|
|
140
|
+
|
|
141
|
+
if (this.marker) {
|
|
142
|
+
this.marker.setMap(null);
|
|
143
|
+
this.marker = null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this.marker = new window.woosmap.map.Marker({
|
|
147
|
+
icon: { url: markerIcon, scaledSize: { height: 46, width: 30 } },
|
|
148
|
+
position: selectedLocality.geometry.location,
|
|
149
|
+
map: this.map,
|
|
150
|
+
});
|
|
135
151
|
} else {
|
|
136
152
|
this.map.setZoom(10);
|
|
137
153
|
}
|
|
@@ -304,31 +320,21 @@ export default class LocalitiesAddressDemo extends Component {
|
|
|
304
320
|
);
|
|
305
321
|
};
|
|
306
322
|
|
|
307
|
-
|
|
308
|
-
|
|
323
|
+
displayMap = () => {
|
|
324
|
+
if (this.timeoutMap) {
|
|
325
|
+
clearTimeout(this.timeoutMap);
|
|
326
|
+
}
|
|
309
327
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return (
|
|
317
|
-
<GoogleMapReact
|
|
318
|
-
defaultZoom={10}
|
|
319
|
-
center={[location.lat, location.lng]}
|
|
320
|
-
bootstrapURLKeys={{ key: Constants.gmapKey, libraries: ['geometry', 'places'] }}
|
|
321
|
-
yesIWantToUseGoogleMapApiInternals
|
|
322
|
-
onGoogleApiLoaded={({ map }) => {
|
|
323
|
-
this.map = map;
|
|
324
|
-
this.displayOnMap();
|
|
325
|
-
}}
|
|
326
|
-
>
|
|
327
|
-
{marker}
|
|
328
|
-
</GoogleMapReact>
|
|
329
|
-
);
|
|
328
|
+
if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
|
|
329
|
+
this.map = new window.woosmap.map.Map(this.mapDivRef.current);
|
|
330
|
+
this.requestAddress();
|
|
331
|
+
} else {
|
|
332
|
+
this.timeoutMap = setTimeout(this.displayMap, 300);
|
|
333
|
+
}
|
|
330
334
|
};
|
|
331
335
|
|
|
336
|
+
renderMap = () => <div className="map" ref={this.mapDivRef} />;
|
|
337
|
+
|
|
332
338
|
render() {
|
|
333
339
|
const { response, error, showDetails } = this.state;
|
|
334
340
|
const { noheader, headerLabels, subHeader } = this.props;
|
|
@@ -337,21 +343,24 @@ export default class LocalitiesAddressDemo extends Component {
|
|
|
337
343
|
request = this.requestDetailsUrl;
|
|
338
344
|
}
|
|
339
345
|
return (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
346
|
+
<>
|
|
347
|
+
<Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
|
|
348
|
+
<Demo
|
|
349
|
+
noheader={noheader}
|
|
350
|
+
header={headerLabels}
|
|
351
|
+
subHeader={subHeader}
|
|
352
|
+
id="localities-demo"
|
|
353
|
+
className="demo--localitiesaddress"
|
|
354
|
+
footerFilters={this.renderFooterFilters()}
|
|
355
|
+
headerFilters={this.renderHeaderFilters()}
|
|
356
|
+
request={request}
|
|
357
|
+
params={this.getRequestparams()}
|
|
358
|
+
referer="http://localhost/"
|
|
359
|
+
response={error || response}
|
|
360
|
+
result={this.renderAddress()}
|
|
361
|
+
map={this.renderMap()}
|
|
362
|
+
/>
|
|
363
|
+
</>
|
|
355
364
|
);
|
|
356
365
|
}
|
|
357
366
|
}
|
|
@@ -3,17 +3,17 @@ import axios from 'axios';
|
|
|
3
3
|
import cl from 'classnames';
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import GoogleMapReact from 'google-map-react';
|
|
7
6
|
import Demo from './SkeletonDemo';
|
|
8
|
-
import Marker from '../Map/Marker';
|
|
9
7
|
import Input from '../Input/Input';
|
|
10
8
|
import Select from '../Select/Select';
|
|
11
9
|
import Button from '../Button/Button';
|
|
12
10
|
import ButtonGroup from '../Button/ButtonGroup';
|
|
13
11
|
import CountrySelect from '../Select/CountrySelect';
|
|
14
|
-
import { viewpoint } from '../Map/drawOnMap';
|
|
15
12
|
import Constants from '../../Constants';
|
|
16
13
|
import { tr } from '../utils/locale';
|
|
14
|
+
import markerIcon from '../../images/marker.png';
|
|
15
|
+
import Script from '../utils/Script';
|
|
16
|
+
import { WoosmapMapBoundingBox } from '../Map/drawOnMap';
|
|
17
17
|
|
|
18
18
|
const languages = [
|
|
19
19
|
{ value: 'fr', label: 'French' },
|
|
@@ -64,10 +64,12 @@ export default class LocalitiesDemo extends Component {
|
|
|
64
64
|
this.marker = null;
|
|
65
65
|
this.viewport = null;
|
|
66
66
|
this.requestUrl = 'https://api.woosmap.com/localities/autocomplete/';
|
|
67
|
+
this.mapDivRef = React.createRef();
|
|
68
|
+
this.overlay = null;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
componentDidMount() {
|
|
70
|
-
this.
|
|
72
|
+
this.displayMap();
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
componentWillUnmount() {
|
|
@@ -114,14 +116,31 @@ export default class LocalitiesDemo extends Component {
|
|
|
114
116
|
|
|
115
117
|
displayOnMap = () => {
|
|
116
118
|
const { selectedLocality } = this.state;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
|
|
120
|
+
if (this.map && selectedLocality?.location) {
|
|
121
|
+
if (this.marker) {
|
|
122
|
+
this.marker.setMap(null);
|
|
123
|
+
this.marker = null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.overlay) {
|
|
127
|
+
this.overlay.setMap(null);
|
|
128
|
+
this.overlay = null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.marker = new window.woosmap.map.Marker({
|
|
132
|
+
icon: { url: markerIcon, scaledSize: { height: 46, width: 30 } },
|
|
133
|
+
position: selectedLocality.location,
|
|
134
|
+
map: this.map,
|
|
135
|
+
});
|
|
136
|
+
|
|
121
137
|
if (selectedLocality.viewpoint) {
|
|
122
|
-
this.
|
|
123
|
-
this.
|
|
138
|
+
this.overlay = new WoosmapMapBoundingBox(selectedLocality.viewpoint.bounds);
|
|
139
|
+
this.overlay.setMap(this.map);
|
|
140
|
+
|
|
141
|
+
this.map.fitBounds(selectedLocality.viewpoint.bounds, { top: 70, bottom: 70, left: 70, right: 70 });
|
|
124
142
|
} else {
|
|
143
|
+
this.map.setCenter(selectedLocality.location);
|
|
125
144
|
this.map.setZoom(10);
|
|
126
145
|
}
|
|
127
146
|
}
|
|
@@ -170,28 +189,21 @@ export default class LocalitiesDemo extends Component {
|
|
|
170
189
|
return <ul>{result}</ul>;
|
|
171
190
|
};
|
|
172
191
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
yesIWantToUseGoogleMapApiInternals
|
|
185
|
-
onGoogleApiLoaded={({ map }) => {
|
|
186
|
-
this.map = map;
|
|
187
|
-
this.displayOnMap();
|
|
188
|
-
}}
|
|
189
|
-
>
|
|
190
|
-
{marker}
|
|
191
|
-
</GoogleMapReact>
|
|
192
|
-
);
|
|
192
|
+
displayMap = () => {
|
|
193
|
+
if (this.timeoutMap) {
|
|
194
|
+
clearTimeout(this.timeoutMap);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
|
|
198
|
+
this.map = new window.woosmap.map.Map(this.mapDivRef.current);
|
|
199
|
+
this.requestLocalities();
|
|
200
|
+
} else {
|
|
201
|
+
this.timeoutMap = setTimeout(this.displayMap, 300);
|
|
202
|
+
}
|
|
193
203
|
};
|
|
194
204
|
|
|
205
|
+
renderMap = () => <div className="map" ref={this.mapDivRef} />;
|
|
206
|
+
|
|
195
207
|
renderHeaderFilters = () => {
|
|
196
208
|
const { input } = this.state;
|
|
197
209
|
const { usecaseFilter } = this.props;
|
|
@@ -259,22 +271,25 @@ export default class LocalitiesDemo extends Component {
|
|
|
259
271
|
const { localities, error } = this.state;
|
|
260
272
|
const { noheader, headerLabels, subHeader } = this.props;
|
|
261
273
|
return (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
<>
|
|
275
|
+
<Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
|
|
276
|
+
<Demo
|
|
277
|
+
id="localities-demo"
|
|
278
|
+
header={headerLabels}
|
|
279
|
+
subHeader={subHeader}
|
|
280
|
+
docLink="https://developers.woosmap.com/products/localities/get-started/"
|
|
281
|
+
className="demo--localities"
|
|
282
|
+
footerFilters={this.renderFooterFilters()}
|
|
283
|
+
headerFilters={this.renderHeaderFilters()}
|
|
284
|
+
request={this.requestUrl}
|
|
285
|
+
noheader={noheader}
|
|
286
|
+
params={this.getRequestparams()}
|
|
287
|
+
referer="http://localhost/"
|
|
288
|
+
response={error || localities}
|
|
289
|
+
result={this.renderAutocompleteList()}
|
|
290
|
+
map={this.renderMap()}
|
|
291
|
+
/>
|
|
292
|
+
</>
|
|
278
293
|
);
|
|
279
294
|
}
|
|
280
295
|
}
|
|
@@ -2,14 +2,15 @@ import axios from 'axios';
|
|
|
2
2
|
import cl from 'classnames';
|
|
3
3
|
import React, { Component } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import GoogleMapReact, { fitBounds } from 'google-map-react';
|
|
6
5
|
import Demo from './SkeletonDemo';
|
|
7
|
-
import Marker from '../Map/Marker';
|
|
8
6
|
import Input from '../Input/Input';
|
|
9
7
|
import Constants from '../../Constants';
|
|
10
8
|
import FilterSelect from '../Select/FilterSelect';
|
|
11
9
|
import LocalitiesAutocomplete from '../Woosmap/LocalitiesAutocomplete';
|
|
12
10
|
import { tr } from '../utils/locale';
|
|
11
|
+
import markerIcon from '../../images/marker.png';
|
|
12
|
+
import markerIconAlt from '../../images/marker-alt.png';
|
|
13
|
+
import Script from '../utils/Script';
|
|
13
14
|
|
|
14
15
|
export default class SearchDemo extends Component {
|
|
15
16
|
constructor(props) {
|
|
@@ -31,8 +32,13 @@ export default class SearchDemo extends Component {
|
|
|
31
32
|
};
|
|
32
33
|
this.mounted = true;
|
|
33
34
|
this.map = null;
|
|
34
|
-
this.
|
|
35
|
+
this.markers = [];
|
|
35
36
|
this.requestUrl = 'https://api.woosmap.com/stores/search/';
|
|
37
|
+
this.mapDivRef = React.createRef();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
componentDidMount() {
|
|
41
|
+
this.displayMap();
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
componentWillUnmount() {
|
|
@@ -70,38 +76,6 @@ export default class SearchDemo extends Component {
|
|
|
70
76
|
};
|
|
71
77
|
};
|
|
72
78
|
|
|
73
|
-
getZoomAndCenter = (stores) => {
|
|
74
|
-
if (!this.map) {
|
|
75
|
-
return { center: null, zoom: null };
|
|
76
|
-
}
|
|
77
|
-
const bounds = new google.maps.LatLngBounds();
|
|
78
|
-
|
|
79
|
-
const { selectedLocality } = this.state;
|
|
80
|
-
const locality = selectedLocality && selectedLocality.localion ? selectedLocality : this.defaultLocality;
|
|
81
|
-
if (locality && locality.location) {
|
|
82
|
-
bounds.extend(new google.maps.LatLng(locality.location.lat, locality.location.lng));
|
|
83
|
-
}
|
|
84
|
-
if (stores && stores.length > 0) {
|
|
85
|
-
stores.forEach((store) => {
|
|
86
|
-
bounds.extend(new google.maps.LatLng(store.geometry.coordinates[1], store.geometry.coordinates[0]));
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return fitBounds(
|
|
91
|
-
{
|
|
92
|
-
ne: {
|
|
93
|
-
lat: bounds.getNorthEast().lat(),
|
|
94
|
-
lng: bounds.getNorthEast().lng(),
|
|
95
|
-
},
|
|
96
|
-
sw: {
|
|
97
|
-
lat: bounds.getSouthWest().lat(),
|
|
98
|
-
lng: bounds.getSouthWest().lng(),
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
{ height: 360, width: 400 }
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
79
|
requestSearch = () => {
|
|
106
80
|
axios
|
|
107
81
|
.get(this.requestUrl, {
|
|
@@ -110,10 +84,13 @@ export default class SearchDemo extends Component {
|
|
|
110
84
|
.then((response) => {
|
|
111
85
|
if (this.mounted) {
|
|
112
86
|
const { data } = response;
|
|
113
|
-
this.setState(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
87
|
+
this.setState(
|
|
88
|
+
{
|
|
89
|
+
data: data || [],
|
|
90
|
+
error: null,
|
|
91
|
+
},
|
|
92
|
+
this.displayOnMap
|
|
93
|
+
);
|
|
117
94
|
}
|
|
118
95
|
})
|
|
119
96
|
.catch((error) => {
|
|
@@ -164,50 +141,62 @@ export default class SearchDemo extends Component {
|
|
|
164
141
|
return <ul>{result}</ul>;
|
|
165
142
|
};
|
|
166
143
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
144
|
+
displayOnMap = () => {
|
|
145
|
+
if (this.map) {
|
|
146
|
+
const { data, selectedLocality } = this.state;
|
|
147
|
+
const { features } = data;
|
|
148
|
+
|
|
149
|
+
const bounds = new window.woosmap.map.LatLngBounds();
|
|
150
|
+
|
|
151
|
+
if (this.markers.length > 0) {
|
|
152
|
+
this.markers.forEach((marker) => marker.setMap(null));
|
|
153
|
+
this.markers = [];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (features && features.length > 0) {
|
|
157
|
+
features.forEach((store) => {
|
|
158
|
+
const [lng, lat] = store.geometry.coordinates;
|
|
159
|
+
bounds.extend(new window.woosmap.map.LatLng(lat, lng));
|
|
160
|
+
this.markers.push(
|
|
161
|
+
new window.woosmap.map.Marker({
|
|
162
|
+
icon: { url: markerIcon, scaledSize: { height: 46, width: 30 } },
|
|
163
|
+
position: { lat, lng },
|
|
164
|
+
map: this.map,
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const location = selectedLocality?.location || this.defaultLocality.location;
|
|
170
|
+
if (location) bounds.extend(new window.woosmap.map.LatLng(location.lat, location.lng));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (selectedLocality && selectedLocality.location) {
|
|
174
|
+
this.markers.push(
|
|
175
|
+
new window.woosmap.map.Marker({
|
|
176
|
+
icon: { url: markerIconAlt, scaledSize: { height: 46, width: 30 } },
|
|
177
|
+
position: selectedLocality.location,
|
|
178
|
+
map: this.map,
|
|
179
|
+
})
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
this.map.fitBounds(bounds, { top: 70, bottom: 70, left: 70, right: 70 });
|
|
186
184
|
}
|
|
187
|
-
return markers;
|
|
188
185
|
};
|
|
189
186
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
bootstrapURLKeys={{ key: Constants.gmapKey, libraries: ['geometry', 'places'] }}
|
|
200
|
-
yesIWantToUseGoogleMapApiInternals
|
|
201
|
-
onGoogleApiLoaded={({ map }) => {
|
|
202
|
-
this.map = map;
|
|
203
|
-
this.requestSearch();
|
|
204
|
-
}}
|
|
205
|
-
>
|
|
206
|
-
{this.renderMarkers()}
|
|
207
|
-
</GoogleMapReact>
|
|
208
|
-
);
|
|
187
|
+
displayMap = () => {
|
|
188
|
+
if (this.timeoutMap) clearTimeout(this.timeoutMap);
|
|
189
|
+
|
|
190
|
+
if (window.woosmap && window.woosmap.map && this.mapDivRef.current) {
|
|
191
|
+
this.map = new window.woosmap.map.Map(this.mapDivRef.current);
|
|
192
|
+
this.requestSearch();
|
|
193
|
+
} else {
|
|
194
|
+
this.timeoutMap = setTimeout(this.displayMap, 300);
|
|
195
|
+
}
|
|
209
196
|
};
|
|
210
197
|
|
|
198
|
+
renderMap = () => <div className="map" ref={this.mapDivRef} />;
|
|
199
|
+
|
|
211
200
|
renderHeaderFilters = () => {
|
|
212
201
|
const { selectedLocality } = this.state;
|
|
213
202
|
const originInputs = {
|
|
@@ -320,21 +309,24 @@ export default class SearchDemo extends Component {
|
|
|
320
309
|
),
|
|
321
310
|
};
|
|
322
311
|
return (
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
312
|
+
<>
|
|
313
|
+
<Script url={`https://sdk.woosmap.com/map/map.js?key=${Constants.woosmapKey}`} />
|
|
314
|
+
<Demo
|
|
315
|
+
id="search-demo"
|
|
316
|
+
className="demo--search"
|
|
317
|
+
docLink="https://developers.woosmap.com/products/search-api/get-started/"
|
|
318
|
+
header={headerLabels}
|
|
319
|
+
footerFilters={this.renderFooterFilters()}
|
|
320
|
+
headerFilters={this.renderHeaderFilters()}
|
|
321
|
+
request={this.requestUrl}
|
|
322
|
+
params={this.getRequestparams(true)}
|
|
323
|
+
referer="http://localhost/"
|
|
324
|
+
response={error || data}
|
|
325
|
+
noheader={noheader}
|
|
326
|
+
result={this.renderStoreList()}
|
|
327
|
+
map={this.renderMap()}
|
|
328
|
+
/>
|
|
329
|
+
</>
|
|
338
330
|
);
|
|
339
331
|
}
|
|
340
332
|
}
|
|
@@ -55,21 +55,29 @@
|
|
|
55
55
|
sq($buttonHeightNano)
|
|
56
56
|
padding 0
|
|
57
57
|
min-height unset
|
|
58
|
+
&--LOCALITIES
|
|
58
59
|
&--localities
|
|
59
60
|
background-color $localities
|
|
61
|
+
&--GEOLOCATION
|
|
60
62
|
&--geolocation
|
|
61
63
|
background-color $geolocation
|
|
64
|
+
&--DISTANCE
|
|
62
65
|
&--distance
|
|
63
66
|
background-color $distance
|
|
67
|
+
&--STORES
|
|
64
68
|
&--stores
|
|
65
69
|
background-color $stores
|
|
70
|
+
&--ADDRESS
|
|
66
71
|
&--address
|
|
67
72
|
background-color $address
|
|
73
|
+
&--MAP
|
|
68
74
|
&--map
|
|
69
75
|
background-color $map
|
|
76
|
+
&--MERCHANTS
|
|
70
77
|
&--merchants
|
|
71
78
|
background-color $merchant
|
|
72
|
-
&--
|
|
79
|
+
&--TRAFFIC
|
|
80
|
+
&--merchant
|
|
73
81
|
background-color $traffic
|
|
74
82
|
&--free
|
|
75
83
|
background-color $free
|
|
@@ -6,9 +6,9 @@ import Marker from './Marker';
|
|
|
6
6
|
|
|
7
7
|
it('renders a marker', () => {
|
|
8
8
|
const { container } = render(<Marker />);
|
|
9
|
-
expect(container.firstChild).toHaveClass('marker');
|
|
9
|
+
expect(container.firstChild).toHaveClass('ui-marker');
|
|
10
10
|
});
|
|
11
11
|
it('renders a marker with seondary color', () => {
|
|
12
12
|
const { container } = render(<Marker isSecondaryColor />);
|
|
13
|
-
expect(container.firstChild).toHaveClass('marker--alt');
|
|
13
|
+
expect(container.firstChild).toHaveClass('ui-marker--alt');
|
|
14
14
|
});
|