@@ -3,38 +3,42 @@ const { SearchBox } = require("react-google-maps/lib/components/places/SearchBox
33import React from 'react' ;
44
55const TrafficMapComponent = withScriptjs ( withGoogleMap ( ( props ) => {
6-
7- var inputBox =
8- React . createElement ( "input" ,
9- { type :"text" ,
10- placeholder : props . searchBoxText ,
11- style : {
12- boxSizing : `border-box` ,
13- border : `1px solid transparent` ,
14- width : `240px` ,
15- height : `30px` ,
16- marginTop : `10px` ,
17- padding : `0 12px` ,
18- borderRadius : `3px` ,
19- boxShadow : `0 1px 6px rgba(0, 0, 0, 0.3)` ,
20- fontSize : `14px` ,
21- outline : `none` ,
22- textOverflow : `ellipses` }
23- } ) ;
6+ var childs = [ props . markers ] ;
7+ if ( props . showSearchBox ) {
8+ var inputBox =
9+ React . createElement ( "input" ,
10+ { type :"text" ,
11+ placeholder : props . searchBoxText ,
12+ style : {
13+ boxSizing : `border-box` ,
14+ border : `1px solid transparent` ,
15+ width : `240px` ,
16+ height : `30px` ,
17+ marginTop : `10px` ,
18+ padding : `0 12px` ,
19+ borderRadius : `3px` ,
20+ boxShadow : `0 1px 6px rgba(0, 0, 0, 0.3)` ,
21+ fontSize : `14px` ,
22+ outline : `none` ,
23+ textOverflow : `ellipses` }
24+ } ) ;
2425
2526 var searchBox =
2627 React . createElement ( SearchBox ,
2728 { ref : props . onSearchBoxMounted ,
28- bounds : props . bounds ,
29- controlPosition : google . maps . ControlPosition . TOP_LEFT ,
30- onPlacesChanged : props . onPlacesChanged } ,
29+ bounds : props . bounds ,
30+ controlPosition : google . maps . ControlPosition . TOP_LEFT ,
31+ onPlacesChanged : props . onPlacesChanged } ,
3132 inputBox
3233 ) ;
3334
34- var traffic = React . createElement ( TrafficLayer , { } ) ;
35- var childs = [ props . markers ] ;
36- if ( props . showSearchBox ) { childs = [ searchBox , ...childs ] } ;
37- if ( props . showTrafficLayer ) { childs = [ traffic , ...childs ] } ;
35+ childs = [ searchBox , ...childs ] ;
36+ } ;
37+
38+ if ( props . showTrafficLayer ) {
39+ var traffic = React . createElement ( TrafficLayer , { } ) ;
40+ childs = [ traffic , ...childs ]
41+ } ;
3842
3943 return (
4044 React . createElement (
0 commit comments