Initial commit
This commit is contained in:
11
src/routes/rezepte/[name]/+page.server.ts
Normal file
11
src/routes/rezepte/[name]/+page.server.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// import { error } from '@sveltejs/kit';
|
||||
import type { PageLoad } from "./$types";
|
||||
//import { Recipe } from '../../../models/Recipe';
|
||||
//import { dbConnect, dbDisconnect } from '../../../utils/db';
|
||||
|
||||
export async function load({ fetch, params }) {
|
||||
const res = await fetch(`/api/items/${params.name}`);
|
||||
const item = await res.json();
|
||||
|
||||
return item;
|
||||
};
|
46
src/routes/rezepte/[name]/+page.svelte
Normal file
46
src/routes/rezepte/[name]/+page.svelte
Normal file
@@ -0,0 +1,46 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import MultiImgWrapper from './MultiImgWrapper.svelte'
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<h1>{data.name}</h1>
|
||||
|
||||
<MultiImgWrapper wrap={data.images.length>1} class=double>
|
||||
{#each data.images as img}
|
||||
<figure>
|
||||
{#if img.caption}
|
||||
<caption>{img.caption}</caption>
|
||||
{/if}
|
||||
</figure>
|
||||
{/each}
|
||||
</MultiImgWrapper>
|
||||
|
||||
{#if data.ingredients}
|
||||
<h2>Zutaten</h2>
|
||||
{#each data.ingredients as list}
|
||||
{#if list.name}
|
||||
<h3>{list.name}</h3>
|
||||
{/if}
|
||||
<ul>
|
||||
{#each list.list as item}
|
||||
<li>{item.amount} {item.unit} {item.name}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
|
||||
{#if data.instructions}
|
||||
<h2>Zubereitung</h2>
|
||||
{#each data.instructions as list}
|
||||
{#if list.name}
|
||||
<h3>{list.name}</h3>
|
||||
{/if}
|
||||
<ol>
|
||||
{#each list.steps as step}
|
||||
<li>{step}</li>
|
||||
{/each}
|
||||
</ol>
|
||||
{/each}
|
||||
{/if}
|
1
src/routes/rezepte/[name]/.jukit/.jukit_info.json
Normal file
1
src/routes/rezepte/[name]/.jukit/.jukit_info.json
Normal file
@@ -0,0 +1 @@
|
||||
{"terminal": "nvimterm"}
|
10
src/routes/rezepte/[name]/MultiImgWrapper.svelte
Normal file
10
src/routes/rezepte/[name]/MultiImgWrapper.svelte
Normal file
@@ -0,0 +1,10 @@
|
||||
<script>
|
||||
export let wrap = false
|
||||
</script>
|
||||
{#if wrap}
|
||||
<div {...$$restProps}>
|
||||
<slot />
|
||||
</div>
|
||||
{:else}
|
||||
<slot />
|
||||
{/if}
|
Reference in New Issue
Block a user