Skip to content

Commit

Permalink
👽️ Render data using @primicio/helpers package #14
Browse files Browse the repository at this point in the history
  • Loading branch information
M4TThys123 committed Jan 24, 2023
1 parent 8ca7a5d commit 35c495a
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 16 deletions.
19 changes: 5 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"type": "module",
"dependencies": {
"@prismicio/helpers": "^2.3.8",
"boxicons": "^2.1.4"
}
}
27 changes: 27 additions & 0 deletions src/components/+nav.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script>
import { page } from "$app/stores";
</script>

<nav>
<h1>logo</h1>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/diensten">Diensten</a></li>
<li><a href="/over">Over ons</a>/li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>

<style>
/* NAV MENU */
nav {
display: flex;
max-width: 1000px;
width: 100%;
margin: 0 auto;
justify-content: space-between;
}
ul{
display: flex;
}
</style>
12 changes: 12 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
import { page } from "$app/stores";
import Nav from "../components/+nav.svelte";
</script>

<header>
<Nav></Nav>
</header>
<slot/>

17 changes: 17 additions & 0 deletions src/routes/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import createClient from "$lib/vendors/prismicClient.js";

export async function load({ fetch, request }) {

const client = createClient({ fetch, request })
const documents = await client.getAllByType('homepage')

if (documents) {
return {
documents
}
}

return {
status: 404,
}
}
16 changes: 14 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
<script>
import * as prismicH from "@prismicio/helpers";
export let data;
const textfield = data.documents[0].data.ritch_text_field
console.log(data.documents[0].data.ritch_text_field)
</script>

<h1>Dit is de home pagina</h1>

<h2>api data</h2>
{@html prismicH.asHTML(textfield)}

<!-- <pre>{JSON.stringify(data, null, 2)}</pre> -->
17 changes: 17 additions & 0 deletions src/routes/contact/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import createClient from "$lib/vendors/prismicClient.js";

export async function load({ fetch, request }) {

const client = createClient({ fetch, request })
const documents = await client.getAllByType('page')

if (documents) {
return {
documents
}
}

return {
status: 404,
}
}
8 changes: 8 additions & 0 deletions src/routes/contact/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
export let data;
console.log(data.documents)
</script>

<h1>contact pagina</h1>

<pre>{JSON.stringify(data, null, 2)}</pre>

1 comment on commit 35c495a

@vercel
Copy link

@vercel vercel bot commented on 35c495a Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.