Update nav styling

This commit is contained in:
Oliver Davies 2017-10-07 14:39:36 +01:00
parent c45b1e2e64
commit 7d1591d400
2 changed files with 10 additions and 4 deletions

View file

@ -17,9 +17,12 @@ td {
.dib; .dib;
.f6; .f6;
.link; .link;
.ml2; .pv3;
} }
.nav-item--active { .nav-item--active {
.b--blue;
.bb;
.black; .black;
.bw1;
} }

View file

@ -17,9 +17,12 @@
<nav class="db dtc-ns v-mid w-100 tl tr-ns mt2 mt0-ns"> <nav class="db dtc-ns v-mid w-100 tl tr-ns mt2 mt0-ns">
{% for link in links %} {% for link in links %}
{% set pattern = '#^' ~ (link.pattern ?: link.href) ~ '/?#' %} {% set classes = [
<a href="{{ link.href }}" class="nav-item {{ page.url matches pattern ? 'nav-item--active' }}"> 'nav-item',
{# <a href="{{ link.href }}" class="f6 hover-blue link dib pa3 {{ page.url matches pattern ? 'black bb b--blue bw1' : 'black-50' }}"> #} not loop.first ? 'ml3',
page.url matches '#^' ~ (link.pattern ?: link.href) ~ '/?#' ? 'nav-item--active',
] %}
<a href="{{ link.href }}" class="{{ classes|join(' ') }}">
{{- link.title -}} {{- link.title -}}
</a> </a>
{% endfor %} {% endfor %}