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