kjelsrud.dev/src/components/BlogHeader.astro

30 lines
854 B
Text
Raw Normal View History

---
import ThemeIcon from './ThemeIcon.astro';
function toggleTheme() {
const currentTheme = document.body.getAttribute('data-theme');
document.body.setAttribute('data-theme', currentTheme === 'dark' ? 'light' : 'dark');
}
---
<header class="flex justify-between items-center py-5">
<div>
<a class="text-l font-semibold" href="/blog">
<svg class="w-6 h-6 text-gray-800 dark:text-white" style="color: var(--color-current);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 19-7-7 7-7"/>
</svg>
</a>
</div>
<ThemeIcon />
</header>
<style>
[data-theme='dark'] {
--color-current: #9AD3BB;
}
[data-theme='light'] {
--color-current: #3B2C29;
}
</style>