Commit 4ff8ccf8 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[ERGO] Handed button does not disappear under mouse pointer after click

parent 6a2d34c2
...@@ -117,12 +117,12 @@ publicLayoutCpt = R.hooksComponentWithModule thisModule "publicLayout" cpt ...@@ -117,12 +117,12 @@ publicLayoutCpt = R.hooksComponentWithModule thisModule "publicLayout" cpt
[ H.div { className:"container1" [ H.div { className:"container1"
, style: { marginBottom : "15px"} , style: { marginBottom : "15px"}
} }
[ H.h2 {} [H.text "Discover knowledge" [ H.h2 {} [ H.text "Discover knowledge"
, H.p { className: "lead text-muted center"} , H.p { className: "lead text-muted center"}
[ H.text "maps made with " [ H.text "maps made with "
, H.span {className: "fa fa-heart"} [] , H.span {className: "fa fa-heart"} []
] ]
] ]
] ]
] ]
-- | TODO browse maps -- | TODO browse maps
......
...@@ -6,7 +6,6 @@ import Data.Tuple (fst) ...@@ -6,7 +6,6 @@ import Data.Tuple (fst)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Types (Handed(..)) import Gargantext.Types (Handed(..))
...@@ -15,9 +14,7 @@ import Gargantext.Utils.Reactix as R2 ...@@ -15,9 +14,7 @@ import Gargantext.Utils.Reactix as R2
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.TopBar" thisModule = "Gargantext.Components.TopBar"
type TopBarProps = ( type TopBarProps = (handed :: R.State Handed)
handed :: R.State Handed
)
topBar :: R2.Component TopBarProps topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt topBar = R.createElement topBarCpt
...@@ -31,35 +28,41 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt ...@@ -31,35 +28,41 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
, className: "navbar navbar-inverse navbar-fixed-top" } , className: "navbar navbar-inverse navbar-fixed-top" }
[ H.div { className: "container-fluid" } [ H.div { className: "container-fluid" }
[ H.div { className: "navbar-inner" } [ H.div { className: "navbar-inner" }
[ logo (fst handed) [ logo false (fst handed)
, H.div { className: "collapse navbar-collapse" <> navHanded} ( , H.div { className: "collapse navbar-collapse" <> navHanded false}
[ ( [
H.ul { className: "nav navbar-nav" <> navHanded} [] H.ul { className: "nav navbar-nav" <> navHanded false} []
, H.ul { title: "If you are Left Handed you can change " , handButton false handed
<> "the interface by clicking on me. Click " , H.ul { className: "nav navbar-nav" <> navHanded false} [divDropdownLeft {} []]
<> "again to come back to previous state." {-, H.ul { title: "Dark Mode soon here"
, className: "nav navbar-nav" <> navHanded , className : "nav navbar-nav"
} [handedChooser { handed } []] } [ H.li {} [ H.a {} [ H.span {className : "fa fa-moon"}[]
, H.ul { className: "nav navbar-nav" <> navHanded} [divDropdownLeft {} []] ]
{-, H.ul { title: "Dark Mode soon here" ]
, className : "nav navbar-nav" ]
} [ H.li {} [ H.a {} [ H.span {className : "fa fa-moon"}[] -}
] ] <> children
] )
] ]
-} , H.div { className: "navbar-inner" }
] <> children) [ handButton true handed
] ]
] ]
] ]
where where
navHanded = if fst handed == LeftHanded then " navbar-right" else "" navHanded t = if xor t (fst handed == LeftHanded) then " navbar-right" else " navbar-left"
handButton t handed = H.ul { title: "If you are Left Handed you can change "
<> "the interface by clicking on me. Click "
<> "again to come back to previous state."
, className: "nav navbar-nav" <> navHanded t
} [handedChooser { handed } []]
-- sortHanded = if fst handed == LeftHanded then reverse else reverse -- identity -- sortHanded = if fst handed == LeftHanded then reverse else reverse -- identity
-- SB.searchBar {session, databases: allDatabases} -- SB.searchBar {session, databases: allDatabases}
logo :: Handed -> R.Element logo :: Boolean -> Handed -> R.Element
logo handed = logo b handed =
H.a { className, href: "#/" } H.a { className, href: "#/" }
[ H.img { src, title, width: "30", height: "28" } [ H.img { src, title, width: "30", height: "28" }
] ]
...@@ -67,7 +70,7 @@ logo handed = ...@@ -67,7 +70,7 @@ logo handed =
className = "navbar-brand logoSmall" <> navHanded className = "navbar-brand logoSmall" <> navHanded
src = "images/logoSmall.png" src = "images/logoSmall.png"
title = "Back to home." title = "Back to home."
navHanded = if handed == LeftHanded then " navbar-right" else "" navHanded = if xor b (handed == LeftHanded) then " navbar-right" else ""
divDropdownLeft :: R2.Component () divDropdownLeft :: R2.Component ()
......
module Gargantext.Prelude (module Prelude, logs, logExceptions, id, class Read, read) module Gargantext.Prelude (module Prelude, logs, logExceptions, id, class Read, read, xor)
where where
import Data.Maybe (Maybe) import Data.Maybe (Maybe)
...@@ -35,3 +35,9 @@ logExceptions message f x = ...@@ -35,3 +35,9 @@ logExceptions message f x =
logs e logs e
throwException e) do throwException e) do
pure $ f x pure $ f x
xor :: Boolean -> Boolean -> Boolean
xor true false = true
xor false true = true
xor _ _ = false
...@@ -10,23 +10,21 @@ import Data.Generic.Rep.Ord (genericCompare) ...@@ -10,23 +10,21 @@ import Data.Generic.Rep.Ord (genericCompare)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Int (toNumber) import Data.Int (toNumber)
import Data.Maybe (Maybe(..), maybe, fromMaybe) import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Prelude
import Prim.Row (class Union) import Prim.Row (class Union)
import Reactix as R import Reactix as R
import URI.Query (Query) import URI.Query (Query)
import Gargantext.Prelude -------------------------------------------------------------------------
data Handed = LeftHanded | RightHanded data Handed = LeftHanded | RightHanded
derive instance genericHanded :: Generic Handed _ derive instance genericHanded :: Generic Handed _
instance eqHanded :: Eq Handed where instance eqHanded :: Eq Handed where
eq = genericEq eq = genericEq
reverseHanded :: Handed -> Handed
reverseHanded LeftHanded = RightHanded
reverseHanded RightHanded = LeftHanded
------------------------------------------------------------------------- -------------------------------------------------------------------------
type ID = Int type ID = Int
type Name = String type Name = String
......
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