Tidy nav code

This commit is contained in:
Oliver Davies 2018-04-26 14:54:14 +01:00
parent 82b80a4d42
commit 82fb207372

View file

@ -16,48 +16,17 @@
</div> </div>
{% set links = [ {% set links = [
{ { title: 'About', href: '/', pattern: '^/.$' },
title: 'About', { title: 'Experience', href: '/experience', pattern: '^/experience/?$' },
href: '/', { title: 'Talks', href: '/talks', pattern: '^/talks/?' },
pattern: '^/.$' { title: 'Open Source', href: '/opensource', pattern: '^/opensource/?$' },
}, { title: 'Blog', href: '/blog', pattern: '^/blog/?' },
{ { title: 'Contact', href: '/contact', pattern: '^/contact/?' }
title: 'Experience',
href: '/experience',
pattern: '^/experience/?$'
},
{
title: 'Talks',
href: '/talks',
pattern: '^/talks/?'
},
{
title: 'Open Source',
href: '/opensource',
pattern: '^/opensource/?$'
},
{
title: 'Blog',
href: '/blog',
pattern: '^/blog/?'
},
{
title: 'Contact',
href: '/contact',
pattern: '^/contact/?'
}
] %} ] %}
<nav class="hidden w-full md:w-2/3 lg:w-3/4 sm:flex sm:flex-wrap sm:justify-end"> <nav class="hidden w-full md:w-2/3 lg:w-3/4 sm:flex sm:flex-wrap sm:justify-end">
{% for link in links %} {% for link in links %}
<a <a href="{{ link.href }}" class="flex items-center -mx-4 p-4 sm:border-b-3 sm:border-transparent sm:ml-4 sm:mr-0 sm:p-0 {{ loop.first ? 'border-t border-grey-lighter sm:border-t-0 sm:border-transparent' }} {{ page.url matches '#' ~ link.pattern ~ '#' ? 'sm:bg-transparent sm:border-blue' }}">
href="{{ link.href }}"
class="
flex items-center -mx-4 p-4 sm:border-b-3 sm:border-transparent sm:ml-4 sm:mr-0 sm:p-0
{{ loop.first ? 'border-t border-grey-lighter sm:border-t-0 sm:border-transparent' }}
{{ page.url matches '#' ~ link.pattern ~ '#' ? 'sm:bg-transparent sm:border-blue' }}
"
>
{{ link.title }} {{ link.title }}
</a> </a>
{% endfor %} {% endfor %}