Full rewrite: swap out the v1 framework (src/, controllers/, views/, twig/, sass/, skeleton/) for the working v2 codebase from phpproject (App/, novaconium/, public/).
26 lines
861 B
Twig
26 lines
861 B
Twig
{% import '_layout/icons.twig' as icons %}
|
|
<nav>
|
|
<a href="/">{{ icons.home() }}Home</a>
|
|
<a href="/about">About</a>
|
|
<a href="/blog">Blog</a>
|
|
<a href="/contact">Contact</a>
|
|
<a href="/admin">Admin</a>
|
|
<button type="button" class="theme-toggle icon-link" aria-label="Toggle dark/light theme">
|
|
{{ icons.sun('theme-toggle-sun') }}{{ icons.moon('theme-toggle-moon') }}
|
|
</button>
|
|
</nav>
|
|
<script>
|
|
document.addEventListener('click', function (event) {
|
|
var button = event.target.closest('.theme-toggle');
|
|
if (!button) {
|
|
return;
|
|
}
|
|
|
|
var isLight = document.documentElement.getAttribute('data-theme') === 'light';
|
|
var next = isLight ? 'dark' : 'light';
|
|
|
|
document.documentElement.setAttribute('data-theme', next);
|
|
localStorage.setItem('theme', next);
|
|
});
|
|
</script>
|