Add error page on Shop
This commit is contained in:
56
src/routes/shop/__error.svelte
Normal file
56
src/routes/shop/__error.svelte
Normal file
@@ -0,0 +1,56 @@
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte'
|
||||
import Metas from '$components/Metas.svelte'
|
||||
import PageTransition from '$components/PageTransition.svelte'
|
||||
import ShopHeader from '$components/organisms/ShopHeader.svelte'
|
||||
import PostersGrid from '$components/organisms/PostersGrid.svelte'
|
||||
|
||||
export let status: number
|
||||
|
||||
const { posters } = getContext('shop')
|
||||
const errors = {
|
||||
404: {
|
||||
title: 'Product not found',
|
||||
message: 'The product you are looking for does not exist… yet!',
|
||||
},
|
||||
500: {
|
||||
title: 'Server error',
|
||||
message: "That is embarassing, the problem is on our side.",
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<Metas
|
||||
title="{errors[status].title} – Houses Of"
|
||||
/>
|
||||
|
||||
|
||||
<PageTransition name="shop-page">
|
||||
<ShopHeader />
|
||||
|
||||
<section class="shop-page__error">
|
||||
<div class="container grid">
|
||||
<div class="inner">
|
||||
<h2 class="title-big">Uh oh!</h2>
|
||||
<p class="text-medium">{errors[status].message}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PostersGrid {posters} />
|
||||
</PageTransition>
|
||||
|
||||
|
||||
<script context="module" lang="ts">
|
||||
import type { LoadEvent, LoadOutput } from '@sveltejs/kit'
|
||||
|
||||
export async function load ({ fetch, status }: LoadEvent): Promise<LoadOutput> {
|
||||
console.log(status)
|
||||
|
||||
return {
|
||||
props: {
|
||||
status,
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -30,6 +30,35 @@
|
||||
transform: translate3d(0,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
// Error
|
||||
&__error {
|
||||
padding: 64px 0;
|
||||
background: $color-cream;
|
||||
color: $color-text;
|
||||
text-align: center;
|
||||
|
||||
@include bp (sm) {
|
||||
padding: clamp(64px, 12vw, 160px) 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.inner {
|
||||
grid-column: 1 / span 8;
|
||||
|
||||
@include bp (sm) {
|
||||
grid-column: 3 / span 12;
|
||||
}
|
||||
}
|
||||
h2 {
|
||||
margin-bottom: 8px;
|
||||
color: $color-secondary;
|
||||
|
||||
@include bp (sm) {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cart
|
||||
|
||||
Reference in New Issue
Block a user