ReactBootstrap.purs 1.61 KB
Newer Older
1 2
module Gargantext.Utils.ReactBootstrap where

3
import Effect (Effect)
4 5 6 7
import Reactix as R

import Gargantext.Prelude

8 9
import Gargantext.Utils.Reactix as R2

10 11 12 13 14 15 16 17 18 19 20
type OverlayTriggerProps =
  (
    overlay   :: R.Element
  , placement :: String
  , trigger   :: String
  )

type Props =
  (
  )

21 22 23 24 25 26
type AlertProps =
  ( dismissible :: Boolean
  , onClose     :: Effect Unit
  , variant     :: String
  )

27 28 29 30 31 32 33 34 35
type ContentProps =
  (
  )

type TitleProps =
  (
    "as" :: String
  )

36
foreign import alertCpt :: R.Component AlertProps
37 38 39 40 41
foreign import overlayTriggerCpt :: R.Component OverlayTriggerProps
foreign import popoverCpt :: R.Component Props
foreign import popoverContentCpt :: R.Component ContentProps
foreign import popoverTitleCpt :: R.Component TitleProps

42 43 44 45
alert :: R2.Component AlertProps
alert = R.rawCreateElement alertCpt

overlayTrigger :: R2.Component OverlayTriggerProps
46 47
overlayTrigger = R.rawCreateElement overlayTriggerCpt

48
popover :: R2.Component Props
49 50
popover = R.rawCreateElement popoverCpt

51
popoverContent :: R2.Component ContentProps
52 53
popoverContent = R.rawCreateElement popoverContentCpt

54
popoverTitle :: R2.Component TitleProps
55 56 57 58 59 60 61 62 63 64 65 66 67 68
popoverTitle = R.rawCreateElement popoverTitleCpt


-- example
-- example =
--     let popover = GUB.popover {} [
--               GUB.popoverTitle { "as": "h3" } [ H.text "hello title" ]
--             , GUB.popoverContent {} [ H.div {} [ H.text "content" ] ]
--            ]
--     in GUB.overlayTrigger { overlay: popover
--                           , placement: "right"
--                           , trigger: "click" } [
--       H.button { className: "btn btn-default" } [ H.text "Click me" ]
--       ]