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

[Popover] onOpen/onClose props

parent 9a759b06
...@@ -4,7 +4,7 @@ import Gargantext.Prelude ...@@ -4,7 +4,7 @@ import Gargantext.Prelude
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Nullable (null) import Data.Nullable (null)
import Data.Tuple (Tuple(..), snd) import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Effect (Effect) import Effect (Effect)
...@@ -69,6 +69,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el ...@@ -69,6 +69,7 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
-- only 1 popup at a time is allowed to be opened -- only 1 popup at a time is allowed to be opened
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile) droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
isDragOver <- R.useState' false isDragOver <- R.useState' false
popoverOpen <- R.useState' false
popperRef <- R.useRef null popperRef <- R.useRef null
...@@ -82,7 +83,9 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el ...@@ -82,7 +83,9 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
} }
[ nodeText { isSelected: (mCorpusId mCurrentRoute) == (Just id) [ nodeText { isSelected: (mCorpusId mCurrentRoute) == (Just id)
, name: name' props} ] , name: name' props} ]
, Popover.popover {} [ , Popover.popover { open: fst popoverOpen
, onClose: \_ -> snd popoverOpen $ const false
, onOpen: \_ -> snd popoverOpen $ const true } [
popOverIcon true popOverIcon true
, mNodePopupView props showBox , mNodePopupView props showBox
] ]
......
module Gargantext.Utils.Popover where module Gargantext.Utils.Popover where
import Data.Nullable (Nullable) import Effect (Effect)
import DOM.Simple.Types (Element)
import Reactix as R import Reactix as R
import Type.Row as TR
import Gargantext.Prelude import Gargantext.Prelude
type Props = () type Props =
(
open :: Boolean
, onClose :: Unit -> Effect Unit
, onOpen :: Unit -> Effect Unit
)
foreign import popoverCpt :: R.Component Props 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