Commit 802b8833 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[popover] arrow option, turn it off by default

parent adb0e070
......@@ -87,7 +87,8 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
pure $ H.span (dropProps droppedFile isDragOver) $
[ folderIcon nodeType folderOpen
, if showBox then
Popover.popover { open: false
Popover.popover { arrow: false
, open: false
, onClose: \_ -> pure unit
, onOpen: \_ -> pure unit
, ref: popoverRef } [
......
......@@ -7,6 +7,6 @@ if (typeof window !== 'undefined') {
}
exports.popoverCpt = popover;
exports._setState = function(el, open) {
el.setState({open: open});
exports._setState = function(el, val) {
el.setState(val);
}
module Gargantext.Utils.Popover where
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..), maybe)
import Data.Nullable (Nullable, toMaybe)
import DOM.Simple as DOM
import DOM.Simple.Console (log2)
......@@ -15,7 +15,8 @@ type PopoverRef = R.Ref (Nullable DOM.Element)
type Props =
(
open :: Boolean
arrow :: Boolean
, open :: Boolean
, onClose :: Unit -> Effect Unit
, onOpen :: Unit -> Effect Unit
, ref :: PopoverRef
......@@ -26,14 +27,10 @@ foreign import popoverCpt :: R.Component Props
popover :: Record Props -> Array R.Element -> R.Element
popover = R.rawCreateElement popoverCpt
foreign import _setState :: EffectFn2 DOM.Element Boolean Unit
foreign import _setState :: forall a. EffectFn2 DOM.Element a Unit
setState :: DOM.Element -> Boolean -> Effect Unit
setState :: forall a. DOM.Element -> a -> Effect Unit
setState = runEffectFn2 _setState
setOpen :: PopoverRef -> Boolean -> Effect Unit
setOpen ref val =
case toMaybe $ R.readRef ref of
Nothing -> pure unit
Just p -> do
setState p val
setOpen ref val = maybe (pure unit) (\p -> setState p {open: val}) $ toMaybe $ R.readRef ref
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