Navbar rewrite.

beta
Philippe Pittoli 2023-07-15 16:29:51 +02:00
parent e4c696b656
commit 62078e04b8
1 changed files with 11 additions and 12 deletions

View File

@ -14,13 +14,10 @@ netlibre_navbar authenticated admin actionHome actionDomainList actionAuthdAdmin
[ nav_brand [ logo, burger_menu ]
, nav_menu
[ navbar_start
[ link_home
, case authenticated of
false -> HH.div_ []
true -> link_domains
, case authenticated, admin of
true, true -> link_authd_admin
_, _ -> HH.div_ []
[ HH.div [HP.classes C.buttons] $ case authenticated, admin of
false, _ -> [ link_home ]
_, false -> [ link_home, link_domains ]
_, _ -> [ link_home, link_domains, link_authd_admin ]
--, dropdown "List of something"
-- [ dropdown_element "something 1"
-- , dropdown_element "something 2"
@ -33,7 +30,7 @@ netlibre_navbar authenticated admin actionHome actionDomainList actionAuthdAdmin
[ navbar_item
[ HH.div [HP.classes C.buttons] $ case authenticated of
false -> [ nav_button_strong "Register" actionRegister
, nav_button_light "Login" actionLogin
, nav_button C.is_info "Login" actionLogin
, nav_button_code
]
_ -> [ nav_button_code ]
@ -54,18 +51,20 @@ netlibre_navbar authenticated admin actionHome actionDomainList actionAuthdAdmin
nav_menu = HH.div [HP.id "navbarExample", HP.classes C.navbar_menu]
navbar_start = HH.div [HP.classes C.navbar_start]
navbar_end = HH.div [HP.classes C.navbar_end]
link_home = HH.a [HP.classes C.navbar_item, HE.onClick (\_ -> actionHome)] [HH.text "Home"]
link_domains = HH.a [HP.classes C.navbar_item, HE.onClick (\_ -> actionDomainList)] [HH.text "Domain List"]
link_authd_admin = HH.a [HP.classes C.navbar_item, HE.onClick (\_ -> actionAuthdAdmin)] [HH.text "Authd Admin"]
link_home = nav_button C.is_info "Home" actionHome
link_domains = nav_button C.is_info "Domains" actionDomainList
link_authd_admin = nav_button C.is_info "Authd Admin" actionAuthdAdmin
--dropdown title dropdown_elements
-- = HH.div [HP.classes (C.navbar_item <> C.has_dropdown <> C.is_hoverable)]
-- [ dropdown_title title, HH.div [HP.classes C.navbar_dropdown] dropdown_elements ]
--dropdown_title str = HH.a [HP.classes C.navbar_link] [HH.text str]
--dropdown_element str = HH.a [HP.classes C.navbar_item] [HH.text str]
--dropdown_separator = HH.hr [HP.classes C.navbar_divider]
nav_button_code = btn_link [] "https://git.baguette.netlib.re/Baguette/dnsmanager" "Code"
nav_button_strong str action = btn C.is_primary action (HH.strong [] [ HH.text str ])
nav_button_light str action = btn C.is_light action (HH.text str)
nav_button classes str action = btn classes action (HH.text str)
navbar_item = HH.div [HP.classes C.navbar_item]
btn_link c link str