simplify structure by remove (rezepte)

This commit is contained in:
2024-01-20 16:39:27 +01:00
parent 36e0abb26d
commit c4c72bd8f0
26 changed files with 2 additions and 2 deletions

View File

@ -0,0 +1,22 @@
<script lang="ts">
import type { PageData } from './$types';
import "$lib/css/nordtheme.css";
export let data: PageData;
import TagCloud from '$lib/components/TagCloud.svelte';
import TagBall from '$lib/components/TagBall.svelte';
</script>
<style>
h1 {
text-align: center;
font-size: 3rem;
}
</style>
<h1>Kategorien</h1>
<section>
<TagCloud>
{#each data.categories as tag}
<TagBall {tag} ref="/rezepte/category">
</TagBall>
{/each}
</TagCloud>
</section>

View File

@ -0,0 +1,7 @@
import type { PageLoad } from "./$types";
export async function load({ fetch}) {
const res = await fetch(`/api/rezepte/items/category`);
const categories= await res.json();
return {categories}
};

View File

@ -0,0 +1,24 @@
<script lang="ts">
import type { PageData } from './$types';
import Recipes from '$lib/components/Recipes.svelte';
import Search from '$lib/components/Search.svelte';
export let data: PageData;
export let current_month = new Date().getMonth() + 1;
import Card from '$lib/components/Card.svelte'
import { rand_array } from '$lib/js/randomize';
</script>
<style>
h1 {
text-align: center;
font-size: 3em;
}
</style>
<h1>Rezepte in Kategorie <q>{data.category}</q>:</h1>
<Search></Search>
<section>
<Recipes>
{#each rand_array(data.recipes) as recipe}
<Card {recipe} {current_month}></Card>
{/each}
</Recipes>
</section>

View File

@ -0,0 +1,10 @@
import type { PageLoad } from "./$types";
export async function load({ fetch, params }) {
const res = await fetch(`/api/rezepte/items/category/${params.category}`);
const items = await res.json();
return {
category: params.category,
recipes: items
}
};