Skip to content

Commit

Permalink
feat: custom error page
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Jan 5, 2024
1 parent a1fa9ba commit 9578305
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="min-h-screen flex flex-grow items-center justify-center">
<div class="bg-fg/5 dark:bg-fg/10 text-fg-dimmed p-8 rounded-2xl border border-fg/10 dark:border-fg/15 w-full max-w-xl">
<h1 class="mb-4 text-2xl font-light text-center">
{{ $t('error.title') }} {{ error.statusCode }}
</h1>
<div class="text-sm">
<template v-if="error.statusCode === 404">
<p class="text-center">
{{ $t('error.page404') }}
</p>
<p class="text-center mt-4">
<NuxtLink to="/" class="text-brand-600 hover:text-brand-800 transition-all">
{{ $t('error.home') }}
</NuxtLink>
</p>
</template>
<template v-else>
<p class="text-center">
{{ $t('error.description') }}
</p>

<p class="text-center mt-2">
<a href="https://mafl.hywax.space/" class="text-brand-600 hover:text-brand-800 transition-all">{{ $t('error.action') }} →</a>
</p>
<pre v-if="error?.message" class="mt-6 bg-fg/5 dark:bg-fg/10 text-fg-dimmed px-3 py-2 rounded-2xl border border-fg/10 dark:border-fg/15 max-h-52 overflow-auto"><code>{{ error.message }}</code></pre>
</template>
</div>
</div>
</div>
</template>

<script setup lang="ts">
defineProps<{ error: { message: string, statusCode: number } }>()
</script>

0 comments on commit 9578305

Please sign in to comment.