projects route with layouts and logic

This commit is contained in:
matthieu42morin 2023-11-13 23:59:34 +01:00
parent 8088ce92ea
commit 8282eae10f
5 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,8 @@
import { listProjects } from '$content/projects';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = () => {
return {
projects: listProjects()
};
};

View File

@ -0,0 +1 @@
<slot />

View File

@ -1 +1,12 @@
<p>There is nothing to see yet</p>
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
</script>
<div class="projects-layout">
{data.projects}
</div>
<style lang="postcss">
</style>

View File

@ -0,0 +1,10 @@
<script lang="ts">
import ProjectsContentLayout from '$lib/components/projects/projects-content-layout.svelte';
import type { PageData } from './$types';
export let data: PageData;
</script>
<ProjectsContentLayout projects={data.projects} {...data.post}>
<svelte:component this={data.Component} />
</ProjectsContentLayout>

View File

@ -0,0 +1,8 @@
import { getProject, listProjects } from '$content/projects';
import type { PageLoad } from './$types';
export const entries = () => listProjects().map((post) => ({ slug: post.slug }));
export const load: PageLoad = async ({ params }) => {
return await getProject(params.slug);
};