feat: implement YearNav component
This commit is contained in:
20
src/lib/components/molecules/YearNav.svelte
Normal file
20
src/lib/components/molecules/YearNav.svelte
Normal 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>
|
||||||
@@ -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));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user