feat(nav): refactor primary navigation to split labels + icons; remove redundant nav code

This commit is contained in:
Cory Dransfeldt 2025-04-13 16:56:47 -07:00
parent 38992d10f1
commit b6d5933433
No known key found for this signature in database
23 changed files with 319 additions and 419 deletions

View file

@ -3,12 +3,6 @@
{% tablericon "activity" %}
Recent activity
</h2>
<p>
<a href="/posts" class="article">Posts</a> •
<a href="/links" class="link">Links</a> •
<a href="/watching" class="movies">Watching</a> •
<a href="/books" class="books">Books</a>
</p>
{%- for item in items -%}
<article class="{{ item.type }}">
<aside>

View file

@ -8,12 +8,15 @@
{%- if updateTime -%}
<p class="updated"><em>This page was last updated on {{ updateTime | strip }}.</em></p>
{%- endif -%}
{% render "nav/social.liquid",
{% render "nav/menu.liquid",
page:page,
links:nav.footer_icons
nav:nav.footer_icons
class:"social"
%}
{% render "nav/secondary.liquid",
{% render "nav/menu.liquid",
page:page,
links:nav.footer_text
nav:nav.footer_text
class:"sub-pages"
separator:true
%}
</footer>

View file

@ -1,13 +1,23 @@
{%- capture headerContent -%}
<img class="icon" src="{{ globals.cdn_url }}{{ globals.avatar_header }}?class=w200&v={% appVersion %}" alt"{{ globals.site_name }}" />
<span>Cory</span> <span>Dransfeldt</span>
{%- endcapture -%}
<section class="main-title">
<h1>
{%- if page.url == "/" -%}
{{ globals.site_name }}
{{ headerContent }}
{%- else -%}
<a href="/" tabindex="0">{{ globals.site_name }}</a>
<a href="/" tabindex="0">{{ headerContent }}</a>
{%- endif -%}
</h1>
{% render "nav/primary.liquid",
{% render "nav/menu.liquid",
page:page,
nav:nav
nav:nav.primary_icons
class:"icons"
%}
</section>
{% render "nav/menu.liquid",
page:page,
nav:nav.primary
class:"primary"
%}

View file

@ -1,8 +1,12 @@
{%- assign categoryUrl = link.permalink | downcase -%}
{%- assign isHttp = categoryUrl contains "http" -%}
{%- if categoryUrl | isLinkActive:page.url -%}
{%- capture linkClass -%}
{%- if link.section -%}button{%- endif -%}
{%- if link.icon -%}icon{%- endif -%}
{%- endcapture -%}
<span
class="active {{ link.class }}"
class="active {{ linkClass }}"
aria-current="page"
>
{%- if link.icon -%}
@ -14,7 +18,7 @@
</span>
{%- else -%}
<a
class="{% if link.icon %}{{ link.icon | downcase }} icon {% endif %}{{ link.class }}"
class="{% if link.section %}{{ link.section | downcase }} button {% endif %}{% if link.icon %}{{ link.icon | downcase }} icon {% endif %}"
href="{{ categoryUrl }}"
{% if isHttp -%} rel="me" {%- endif %}
title="{{ link.title }}"

View file

@ -0,0 +1,11 @@
<nav class="{{ class }}">
{%- for link in nav -%}
{% render "nav/link.liquid",
page:page,
link:link
%}
{%- if separator -%}
{% unless forloop.last %}<span>•</span>{% endunless %}
{%- endif -%}
{%- endfor -%}
</nav>

View file

@ -1,12 +0,0 @@
<nav class="primary-navigation">
<ul class="nav-list">
{%- for link in nav.primary -%}
<li>
{% render "nav/link.liquid",
page:page,
link:link
%}
</li>
{%- endfor -%}
</ul>
</nav>

View file

@ -1,9 +0,0 @@
<nav aria-label="Secondary site navigation" class="sub-pages">
{%- for link in links -%}
{% render "nav/link.liquid",
page:page,
link:link
%}
{% unless forloop.last %}<span>•</span>{% endunless %}
{%- endfor -%}
</nav>

View file

@ -1,8 +0,0 @@
<nav aria-label="Social icons" class="social">
{%- for link in links -%}
{% render "nav/link.liquid",
page:page,
link:link
%}
{%- endfor -%}
</nav>