fix links, start working on theme toggle
This commit is contained in:
parent
3320683d10
commit
006d5390c5
|
@ -0,0 +1,26 @@
|
|||
<script lang="ts">
|
||||
// Reactive variable to store the current theme
|
||||
let theme = 'forest'; // default theme
|
||||
|
||||
// On component mount, check for saved theme in local storage
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
theme = localStorage.getItem('theme') || 'forest';
|
||||
updateTheme();
|
||||
});
|
||||
|
||||
// Function to toggle theme
|
||||
function toggleTheme() {
|
||||
theme = theme === 'forest' ? 'light' : 'forest';
|
||||
localStorage.setItem('theme', theme);
|
||||
updateTheme();
|
||||
}
|
||||
|
||||
// Function to update the theme on the body element
|
||||
function updateTheme() {
|
||||
document.body.setAttribute('data-theme', theme);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={toggleTheme}>Toggle Theme</button>
|
|
@ -62,7 +62,7 @@
|
|||
{#each posts as post}
|
||||
<li class="py-4">
|
||||
<h3 class="pb-1">
|
||||
<a class="link-primary" href={post.path}>
|
||||
<a class="link-primary" href={`/poetry/${post.filename}`}>
|
||||
{post.meta.title}
|
||||
</a>
|
||||
</h3>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
{#each posts as post}
|
||||
<li class="py-4">
|
||||
<h3 class="pb-1">
|
||||
<a class="link-primary" href={post.path}>
|
||||
<a class="link-primary" href={`/thoughts/${post.filename}`}>
|
||||
{post.meta.title}
|
||||
</a>
|
||||
</h3>
|
||||
|
|
Loading…
Reference in New Issue