Improve Error Page

This commit is contained in:
2020-12-15 15:31:14 +01:00
parent 312890a3ad
commit a64a080ce7
13 changed files with 77 additions and 79 deletions

View File

@@ -7,6 +7,10 @@ img, svg {
position: static; position: static;
} }
body {
@apply dark:bg-dark-900
}
* { * {
@apply select-none outline-none; @apply select-none outline-none;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -16,7 +16,9 @@
<a class="font-semibold" href="https://twitter.com/ArthurDanj" target="_blank"> <a class="font-semibold" href="https://twitter.com/ArthurDanj" target="_blank">
<img class="inline img" src="@/assets/img/socials/twitter.svg" alt="Twitter logo" height="20" width="20" /> <img class="inline img" src="@/assets/img/socials/twitter.svg" alt="Twitter logo" height="20" width="20" />
<span class="link">Twitter</span> <span class="link">Twitter</span>
</a> {{ $t('footer.separator') }} </a>
<br class="md:hidden"/>
{{ $t('footer.separator') }}
<a class="font-semibold" href="mailto:contact@arthurdanjou.fr" target="_blank"> <a class="font-semibold" href="mailto:contact@arthurdanjou.fr" target="_blank">
<svg class="inline img" width="20" height="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="inline img" width="20" height="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
@@ -24,11 +26,11 @@
<span class="link">Mail</span> <span class="link">Mail</span>
</a> </a>
</p> </p>
<br class="md:hidden"/>
<span class="inline dark:text-dark-200 text-gray-600 text-xs"> <span class="inline dark:text-dark-200 text-gray-600 text-xs">
{{ $t('footer.links_click') }} {{ $t('footer.links_click') }}
</span> </span>
</div> </div>
<br class="md:hidden"/>
<p> <p>
{{ $t('footer.credits') }} {{ $t('footer.credits') }}
<a class="font-semibold" target="_blank" href="https://nuxtjs.org"> <a class="font-semibold" target="_blank" href="https://nuxtjs.org">

View File

@@ -73,8 +73,6 @@ Dans cette version, j'ai utilisé plusieurs technologies :
## 5. Conclusion ## 5. Conclusion
Pour conclure, je suis très satisfait du résultat de cette nouvelle version. Pour conclure, je suis très satisfait du résultat de cette nouvelle version, de ses fonctionnalités.
Je vous laisse visiter le reste du site Je vous laisse visiter le reste du site et me donner votre avis !
### Informations Supplémentaires

View File

@@ -28,6 +28,8 @@ console.log('Hello World !')
Test de lien [Twitter](https://twitter.com/ArthurDanj) Test de lien [Twitter](https://twitter.com/ArthurDanj)
Lien [GitHub](https://github.com/arthurdanjou)
--- ---
Hey Hey
@@ -36,9 +38,3 @@ __hey__
_hey_ _hey_
~~Hey~~ ~~Hey~~
```mermaid
graph TD
A --> B
B --> C
C --> A
```

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="dark:bg-dark-900 dark:text-white font-sans"> <div class="dark:bg-dark-900 dark:text-white font-sans">
<Header /> <Header />
<Nuxt class="z-10 pt-16 lg:pt-24 content"/> <Nuxt class="z-10 pt-16 lg:pt-24 content" />
<Footer /> <Footer />
</div> </div>
</template> </template>
@@ -10,12 +10,9 @@
import Header from "~/components/Header"; import Header from "~/components/Header";
import Footer from "~/components/Footer"; import Footer from "~/components/Footer";
export default { export default {
components: {Footer, Header} components: {Footer, Header},
} }
</script> </script>
<style scoped> <style scoped>
.content {
min-height: calc(100vh - 118px);
}
</style> </style>

View File

@@ -1,17 +0,0 @@
<template>
<div class="dark:bg-dark-900 dark:text-white font-sans">
<Nuxt class="content"/>
</div>
</template>
<script>
export default {
name: "error-2"
}
</script>
<style scoped>
.content {
min-height: calc(100vh - 118px);
}
</style>

View File

@@ -1,23 +1,36 @@
<template> <template>
<main class="error relative"> <main class="error w-full px-5 xl:px-64">
<div class="w-full h-screen"> <div class="mt-24 w-full h-full flex items-center justify-center">
<img class="w-full h-full" src="~/assets/img/404.png" alt="404 Image" /> <div class="flex flex-col items-center md:mb-20">
</div> <div class="flex">
<div class="text absolute inset-1/4 w-full h-screen mb-8"> <div class="h-16 w-16 mr-4">
<div class="flex items-center justify-center h-full"> <svg class="icon inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<div class="flex flex-col justify-center text-center"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
<h1 class="title dark:text-white font-bold"> </svg>
404 </div>
</h1> <div class="mb-12 lining-nums">
<h2 class="text-4xl dark:text-white"> <div class="mb-2">
{{ $t('404.description') }} <p v-if="error.statusCode === 404" class="text-3xl md:text-6xl dark:text-white font-bold">
</h2> {{ $t('error.error').toUpperCase() }} 404
<p class="text-2xl dark:text-dark-100 mb-4"> </p>
{{ $t('404.no_page') }} <p v-else class="text-3xl md:text-6xl dark:text-white font-bold">
</p> {{ $t('error.error').toUpperCase() }} 500
</p>
</div>
<div class="flex flex-col">
<p v-if="error.statusCode === 404" class="text-xl md:text-2xl text-gray-900 dark:text-dark-100">
{{ $t('error.no_page') }}
</p>
<p v-else class="text-xl md:text-2xl text-gray-900 dark:text-dark-100">
{{ $t('error.internal') }}
</p>
</div>
</div>
</div>
<div>
<nuxt-link class="home-btn" to="/"> <nuxt-link class="home-btn" to="/">
<div class="py-3 px-6 font-bold border-2 border-solid border-red-500 hover:bg-red-500 duration-300 rounded"> <div class="w-full py-4 px-8 md:py-8 md:px-16 font-bold hover:bg-red-500 duration-500 rounded">
{{ $t('404.back') }} {{ $t('error.back') }}
<svg class="inline arrow-img" height="32" width="32" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="inline arrow-img" height="32" width="32" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3" />
</svg> </svg>
@@ -32,23 +45,16 @@
<script> <script>
export default { export default {
name: "error", name: "error",
layout: "error-2" props: ['error'],
head: {
title: 'Error - Arthur Danjou'
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.error { .error {
.text {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.title {
font-size: 14rem;
}
.home-btn:hover .arrow-img { .home-btn:hover .arrow-img {
transform: translate(3px, 0); transform: translate(3px, 0);
} }

View File

@@ -19,10 +19,11 @@ export default {
copyrights: '© Copyright {date} - Tous droits réservés' copyrights: '© Copyright {date} - Tous droits réservés'
}, },
404: { error: {
description: 'Où suis-je ?',
back: 'Revenir à l\'accueil', back: 'Revenir à l\'accueil',
no_page: 'La page demandée n\'existe pas' no_page: 'La page demandée n\'existe pas',
internal: 'Erreur interne',
error: 'Erreur'
}, },
part: { part: {

View File

@@ -120,8 +120,12 @@ export default {
liked: false liked: false
} }
}, },
async asyncData({ params, $content, app, $axios }) { async asyncData({ params, $content, app, $axios, error }) {
const post = await $content(`articles/${app.i18n.locale}/`, params.slug).fetch() const post = await $content(`articles/${app.i18n.locale}/`, params.slug)
.fetch()
.catch(() => {
error({ statusCode: 404, message: "Post not found" });
});
const {data: likes} = await $axios.get(`posts/${params.slug}`) const {data: likes} = await $axios.get(`posts/${params.slug}`)
const liked = await $axios.get(`posts/is/${params.slug}`) const liked = await $axios.get(`posts/is/${params.slug}`)
return { return {

View File

@@ -112,9 +112,11 @@ export default {
methods: { methods: {
displayTags(tags) { displayTags(tags) {
const tags_label = [] const tags_label = []
tags.map(tag => { if (tags.length > 0) {
tags_label.push(tag) tags.map(tag => {
}) tags_label.push(tag)
})
}
return tags_label return tags_label
}, },
async fetchPostsByTag(tag) { async fetchPostsByTag(tag) {

View File

@@ -51,6 +51,7 @@
<script> <script>
import WorkSkill from "~/components/WorkSkill"; import WorkSkill from "~/components/WorkSkill";
export default { export default {
components: {WorkSkill}, components: {WorkSkill},
head() { head() {
@@ -63,14 +64,19 @@ export default {
work: null work: null
} }
}, },
async asyncData({ params, $content }) { async asyncData({ params, $content, error }) {
let work const work = await $content('works', params.slug)
try { .fetch()
work = await $content('works', params.slug).fetch() .catch(() => {
} catch (e) { error({
return error({ message: 'Work not found' }) statusCode: 404,
message: 'Work not found',
})
});
let skills = []
if (work) {
skills = await $content('skills').where({ slug: { $in: work.skills } }).fetch()
} }
const skills = await $content('skills').where({ slug: { $in: work.skills } }).fetch()
return { return {
work, work,
skills skills