-
Notifications
You must be signed in to change notification settings - Fork 6
/
GoogleMaps.scala
35 lines (28 loc) · 928 Bytes
/
GoogleMaps.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package weatherApp.components
import scalajs.js
import scalajs.js.annotation._
import japgolly.scalajs.react._
object GoogleMaps {
@JSImport("google-map-react", JSImport.Default)
@js.native
object JsComp extends js.Any
@ScalaJSDefined
trait Props extends js.Object {
val bootstrapURLKeys: js.Object
val center: js.Array[Double]
val zoom: Int
val options: js.Object
}
val Component = JsFnComponent[Props, Children.Varargs](JsComp)
def props(lat: Double, lng: Double, zoom: Int): Props = {
val z = zoom
val k = "AIzaSyBPfBs8b2Z"
new Props {
val bootstrapURLKeys = js.Dynamic.literal(key=s"${k}jQWpR5TlbDWhYwp6FItvK10s")
val center = js.Array(lat, lng)
val zoom = z
val options = js.Dynamic.literal(scrollwheel = false)
}
}
def apply(lat: Double, lng: Double, zoom: Int, children: CtorType.ChildArg) = Component(props(lat, lng, zoom))(children)
}