Commit 66ad76db authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[Popover] onOpen/onClose props

parent 9a759b06
......@@ -4,7 +4,7 @@ import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Nullable (null)
import Data.Tuple (Tuple(..), snd)
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
......@@ -69,6 +69,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
-- only 1 popup at a time is allowed to be opened
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
isDragOver <- R.useState' false
popoverOpen <- R.useState' false
popperRef <- R.useRef null
......@@ -82,7 +83,9 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
}
[ nodeText { isSelected: (mCorpusId mCurrentRoute) == (Just id)
, name: name' props} ]
, Popover.popover {} [
, Popover.popover { open: fst popoverOpen
, onClose: \_ -> snd popoverOpen $ const false
, onOpen: \_ -> snd popoverOpen $ const true } [
popOverIcon true
, mNodePopupView props showBox
]
......
module Gargantext.Utils.Popover where
import Data.Nullable (Nullable)
import DOM.Simple.Types (Element)
import Effect (Effect)
import Reactix as R
import Type.Row as TR
import Gargantext.Prelude
type Props = ()
type Props =
(
open :: Boolean
, onClose :: Unit -> Effect Unit
, onOpen :: Unit -> Effect Unit
)
foreign import popoverCpt :: R.Component Props
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment