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;
.f6;
.link;
.ml2;
.pv3;
}
.nav-item--active {
.b--blue;
.bb;
.black;
.bw1;
}

View file

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