feat: light/dark theme toggle
This commit is contained in:
parent
979cabd6e9
commit
bb0068a4e9
8 changed files with 80 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
{%- capture pageUrl %}/{{ link | downcase }}/{% endcapture -%}
|
||||
{% if pageUrl contains page.fileSlug and page.fileSlug %}
|
||||
<span class="active" aria-current="page">
|
||||
<span class="active {{ class }}" aria-current="page">
|
||||
{% if icon %}
|
||||
{% tablericon icon link %}
|
||||
{% else %}
|
||||
|
@ -9,7 +9,7 @@
|
|||
</span>
|
||||
{% else %}
|
||||
{% if icon %}
|
||||
<a class="{{ icon | downcase }}" href="/{{ link | downcase }}">
|
||||
<a class="{{ icon | downcase }} {{ class }}" href="/{{ link | downcase }}">
|
||||
{% tablericon icon link %}
|
||||
</a>
|
||||
{% else %}
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
<ul class="flex--centered">
|
||||
{% for link in nav.menu %}
|
||||
<li>
|
||||
{% render "partials/nav/link.liquid", page: page, link: link.name, icon: link.icon %}
|
||||
{% render "partials/nav/link.liquid", page: page, link: link.name, icon: link.icon, class: link.class %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% render "partials/nav/theme.liquid" %}
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
8
src/_includes/partials/nav/theme.liquid
Normal file
8
src/_includes/partials/nav/theme.liquid
Normal file
|
@ -0,0 +1,8 @@
|
|||
<li class="theme__toggle client-side">
|
||||
<span class="light">
|
||||
{% tablericon "sun" "Toggle light theme" %}
|
||||
</span>
|
||||
<span class="dark">
|
||||
{% tablericon "moon" "Toggle dark theme" %}
|
||||
</span>
|
||||
</li>
|
Reference in a new issue