Skip to content

Instantly share code, notes, and snippets.

@MangelMaxime
Created October 24, 2017 12:35
Show Gist options
  • Save MangelMaxime/380e19c706795184e4efc10228b84b95 to your computer and use it in GitHub Desktop.
Save MangelMaxime/380e19c706795184e4efc10228b84b95 to your computer and use it in GitHub Desktop.
Fable.Helpers.ReactLeaflet
open Fable.Helpers.React
open Fable.Helpers.React.Props
module RL = Fable.Helpers.ReactLeaflet
let group =
let truckTracks =
zones.paths
|> Array.map(fun path ->
RL.polyline [ RL.PolylineProps.Positions path.points ]
[ ]
)
|> Array.toList
|> RL.layerGroup [ ]
RL.layerGroup [ ]
[ truckTracks ]
module Fable.Helpers.ReactLeaflet
open Fable.Core
open Fable.Core.JsInterop
open Fable.Import.React
open Fable.Helpers.React.Props
[<AutoOpen>]
module Props =
type IReactLeafletMapProp =
inherit IProp
let inline rtEl<[<Pojo>]'P when 'P :> IProp> (a:ComponentClass<'P>) (b:IProp list) c = React.from a (keyValueList CaseRules.LowerFirst b |> unbox) c
type EventProps =
| OnClick of (Fable.Import.L.Event -> unit)
interface IReactLeafletMapProp
type MapProps =
| Center of obj
| Zoom of int
| MinZoom of int
| MaxZoom of int
interface IReactLeafletMapProp
let Map = importMember<ComponentClass<IProp>> "react-leaflet"
let inline map b c = rtEl Map b c
type TileLayerProps =
| Url of string
| Attribution of string
interface IReactLeafletMapProp
let TileLayer = importMember<ComponentClass<IProp>> "react-leaflet"
let inline tileLayer b c = rtEl TileLayer b c
type MarkerProps =
| ZIndexOffset of int
| Draggable of bool
| Opacity of float
| Position of obj
| Children of string
interface IReactLeafletMapProp
let Marker = importMember<ComponentClass<IProp>> "react-leaflet"
let inline marker b c = rtEl Marker b c
type PolylineProps =
| Positions of obj
interface IReactLeafletMapProp
let Polyline = importMember<ComponentClass<IProp>> "react-leaflet"
let inline polyline b c = rtEl Polyline b c
type PolygonProps =
| Positions of obj
interface IReactLeafletMapProp
let Polygon = importMember<ComponentClass<IProp>> "react-leaflet"
let inline polygon b c = rtEl Polygon b c
type TooltipProps =
| OnClose of (Fable.Import.L.Event -> unit)
| OnOpen of (Fable.Import.L.Event -> unit)
| Pane of string
interface IReactLeafletMapProp
let Tooltip = importMember<ComponentClass<IProp>> "react-leaflet"
let inline tooltip b c = rtEl Polygon b c
type PathProps =
| Stroke of obj
| Color of obj
| Weight of int
| Opacity of float
| LineCap of obj
| LineJoin of obj
| DashArray of obj
| DashOffset of obj
| Fill of obj
| FillColor of obj
| FillOpacity of obj
| FillRule of obj
| BubblingMouseEvents of obj
| Renderer of obj
// Interactive Layer
| Interactive of bool
// Layer
| Pane of obj
| Attribution of obj
interface IReactLeafletMapProp
let Path = importMember<ComponentClass<IProp>> "react-leaflet"
let inline path b c = rtEl Path b c
type LayerGroupProps =
| AddLayer of JsFunc
| RemoveLayer of JsFunc
interface IReactLeafletMapProp
let LayerGroup = importMember<ComponentClass<IProp>> "react-leaflet"
let inline layerGroup b c = rtEl LayerGroup b c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment