Commit 84b97575 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FACTO] nav sidebar almost done.

parent a67cfce8
...@@ -246,33 +246,37 @@ divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext" ...@@ -246,33 +246,37 @@ divDropdownLeft = divDropdownLeft' (LiNav { title : "About Gargantext"
} }
) )
divDropdownLeft' :: LiNav -> ReactElement divDropdownLeft' :: LiNav -> ReactElement
divDropdownLeft' (LiNav { title: title' divDropdownLeft' mb = ul [className "nav navbar-nav"]
, href : href'
, icon : icon'
, text : text'
}
) = ul [className "nav navbar-nav"]
[ ul [className "nav navbar-nav pull-left"] [ ul [className "nav navbar-nav pull-left"]
[ li [className "dropdown"] [ li [className "dropdown"]
[ a [ className "dropdown-toggle navbar-text" [ menuButton mb
, _data {toggle: "dropdown"} , menuElements'
, href href', role "button"
, title title'
][ span [ aria {hidden : true}
, className icon'
] []
, text (" " <> text')
]
, ul [className "dropdown-menu"] divLeftdropdownElements
] ]
] ]
] ]
menuButton :: LiNav -> ReactElement
menuButton (LiNav { title : title'
, href : href'
, icon : icon'
, text : text'
}) = a [ className "dropdown-toggle navbar-text"
, _data {toggle: "dropdown"}
, href href', role "button"
, title title'
][ span [ aria {hidden : true}
, className icon'
] []
, text (" " <> text')
]
-- | WYSIWYG example in Pure React ? -- | WYSIWYG example in Pure React ?
divLeftdropdownElements :: Array ReactElement menuElements' :: ReactElement
divLeftdropdownElements = menu -- title, icon, text menuElements' = menuElements-- title, icon, text
[ -- =========================================================== [ -- ===========================================================
[ LiNav { title : "Quick start, tutorials and methodology" [ LiNav { title : "Quick start, tutorials and methodology"
, href : "https://iscpif.fr/gargantext/your-first-map/" , href : "https://iscpif.fr/gargantext/your-first-map/"
...@@ -307,19 +311,22 @@ divLeftdropdownElements = menu -- title, icon, text ...@@ -307,19 +311,22 @@ divLeftdropdownElements = menu -- title, icon, text
] -- =========================================================== ] -- ===========================================================
-- | Menu in the sidebar, syntactic sugar -- | Menu in the sidebar, syntactic sugar
menu :: Array (Array LiNav) -> Array ReactElement menuElements :: Array (Array LiNav) -> ReactElement
menu ns = intercalate divider $ map (map liNav) ns menuElements ns = dropDown $ intercalate divider $ map (map liNav) ns
where where
dropDown :: Array ReactElement -> ReactElement
dropDown = ul [className "dropdown-menu"]
divider :: Array ReactElement divider :: Array ReactElement
divider = [li [className "divider"] []] divider = [li [className "divider"] []]
-- | surgar for target : "blank" -- | surgar for target : "blank"
data LiNav_ = LiNav_ { title :: String --data LiNav_ = LiNav_ { title :: String
, href :: String -- , href :: String
, icon :: String -- , icon :: String
, text :: String -- , text :: String
, target :: String -- , target :: String
} -- }
data LiNav = LiNav { title :: String data LiNav = LiNav { title :: 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