feat: implement YearNav component

This commit is contained in:
Norbert Maciaszek
2025-11-17 18:53:31 +01:00
parent a0949e64a6
commit cc3d3ced5a
2 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
<script lang="ts">
import Button from '../atoms/Button.svelte';
type Props = {
years: Year[];
};
let { years }: Props = $props();
</script>
<div class="mb-6 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center">
<div class="flex items-center gap-2">
<Button variant="secondary" href="/">Prezenty tego roku</Button>
{#each years as year}
<Button href={`/year/${year.year}`} variant="secondary">
{year.year}
</Button>
{/each}
</div>
</div>

View File

@@ -22,7 +22,6 @@
const ready = $derived(gifts.filter((gift) => gift.status === 'ready')); const ready = $derived(gifts.filter((gift) => gift.status === 'ready'));
const wrapped = $derived(gifts.filter((gift) => gift.status === 'wrapped')); const wrapped = $derived(gifts.filter((gift) => gift.status === 'wrapped'));
const total = $derived(getTotal(gifts));
const totalPlanned = $derived(getTotal(planned) + getTotal(decided)); const totalPlanned = $derived(getTotal(planned) + getTotal(decided));
const totalBought = $derived(getTotal(bought) + getTotal(ready) + getTotal(wrapped)); const totalBought = $derived(getTotal(bought) + getTotal(ready) + getTotal(wrapped));