Simplify navbar implementation - this will also allow seamlessly adding a third, centred nav if desired

This commit is contained in:
Danielle McLean 2017-10-06 14:43:00 +11:00
parent 526e105b8b
commit 92373fcfa5
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
3 changed files with 8 additions and 10 deletions

View file

@ -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

View file

@ -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

View file

@ -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