Commit 239057d5 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TREE] some options to add in the tree (css).

parent ac100325
...@@ -197,23 +197,36 @@ exampleTree = ...@@ -197,23 +197,36 @@ exampleTree =
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO
-- alignment to the right
nodeOptionsCorp = [ i [className "fab fa-whmcs" ] []]
-- TODO
-- alignment to the right
-- on hover make other options available:
nodeOptionsView = [ i [className "fas fa-sync-alt" ] []
, i [className "fas fa-upload" ] []
, i [className "fas fa-share-alt"] []
]
toHtml :: _ -> FTree -> ReactElement toHtml :: _ -> FTree -> ReactElement
toHtml d (NLeaf (Tuple name link)) = toHtml d (NLeaf (Tuple name link)) =
li [] li []
[ a [ href link] [ a [ href link]
[ text name ( [ text (name <> " ")
] ] <> nodeOptionsView
)
] ]
toHtml d (NNode id open name ary) = toHtml d (NNode id open name ary) =
ul [ ] ul [ ]
[ li [] $ [ li [] $
[ a [onClick $ (\e-> d $ ToggleFolder id)] [i [fldr open] []] ( [ a [onClick $ (\e-> d $ ToggleFolder id)] [i [fldr open] []]
, text $ " " <> name , text $ " " <> name <> " "
] <> ] <> nodeOptionsCorp <>
if open then if open then
map (toHtml d) ary map (toHtml d) ary
else [] else []
)
] ]
fldr :: Boolean -> Props fldr :: Boolean -> 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