Simplify navbar implementation - this will also allow seamlessly adding a third, centred nav if desired
This commit is contained in:
parent
526e105b8b
commit
92373fcfa5
3 changed files with 8 additions and 10 deletions
|
@ -97,8 +97,7 @@ instance Yesod App where
|
|||
-- Get the breadcrumbs, as defined in the YesodBreadcrumbs instance.
|
||||
(title, parents) <- breadcrumbs
|
||||
|
||||
let navbarLeftMenuItems = leftMenuItems muser
|
||||
navbarRightMenuItems = rightMenuItems muser
|
||||
let navbars = [leftMenuItems, rightMenuItems] <*> [muser]
|
||||
|
||||
-- We break up the default layout into two components:
|
||||
-- default-layout is the contents of the body tag, and
|
||||
|
|
|
@ -15,6 +15,8 @@ body
|
|||
padding-bottom: 1em
|
||||
display: flex
|
||||
justify-content: space-evenly
|
||||
#navbar
|
||||
justify-content: space-between
|
||||
.breadcrumb
|
||||
background-color: #404449
|
||||
border-radius: 0
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
<span .navbar-toggler-icon>
|
||||
|
||||
<div #navbar .collapse.navbar-collapse>
|
||||
<ul .navbar-nav.mr-auto>
|
||||
$forall MenuItem label route <- navbarLeftMenuItems
|
||||
<li .nav-item :Just route == mcurrentRoute:.active>
|
||||
<a .nav-link href=@{route}>#{label}
|
||||
$forall bar <- navbars
|
||||
<ul .navbar-nav>
|
||||
$forall MenuItem label route <- bar
|
||||
<li .nav-item :Just route == mcurrentRoute:.active>
|
||||
<a .nav-link href=@{route}>#{label}
|
||||
|
||||
<ul .navbar-nav>
|
||||
$forall MenuItem label route <- navbarRightMenuItems
|
||||
<li .nav-item :Just route == mcurrentRoute:.active>
|
||||
<a .nav-link href=@{route}>#{label}
|
||||
$if not $ null parents
|
||||
<ul .breadcrumb>
|
||||
$forall bc <- parents
|
||||
|
|
Loading…
Reference in a new issue