simplify error pages

No dependencies and more mobile friendly
This commit is contained in:
Pooya Parsa 2017-09-01 20:29:20 +04:30
parent 9d43db475b
commit a6a36b1d2f
2 changed files with 65 additions and 105 deletions

View File

@ -1,32 +1,23 @@
<template> <template>
<div class="__nuxt-error-page"> <div class="__nuxt-error-page">
<div class="container"> <div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
<div class="row"> <div class="title">{{ message }}</div>
<div class="column"> <p class="description" v-if="statusCode === 404">
<h1>{{ statusCode }} </h1> <nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
<h3> {{ message }} </h3> </p>
<p v-if="statusCode === 404"> <% if(debug) { %>
<nuxt-link class="error-link" to="/">Back to the home page</nuxt-link> <p class="description" v-else>
</p> An error occurred while rendering the page. Check developer tools console for details.
<% if(debug) { %> </p>
<small v-else> <% } %>
Open developer tools to view stack trace
</small>
<% } %>
</div>
</div>
<div class="row"> <div class="logo">
<div class="column"> Powered by <a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a>
<div class="poweredby">
<small> Powered by <a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a> </small>
</div>
</div>
</div>
</div>
</div> </div>
</div>
</div>
</template> </template>
<script> <script>
@ -35,10 +26,12 @@ export default {
props: ['error'], props: ['error'],
head () { head () {
return { return {
title: this.statusCode + ' - ' + this.message, title: this.message,
link: [ meta: [
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css', type: 'text/css', media: 'all' }, {
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css', type: 'text/css', media: 'all' } name: 'viewport',
content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no'
}
] ]
} }
}, },
@ -65,29 +58,45 @@ export default {
<style> <style>
.__nuxt-error-page { .__nuxt-error-page {
background: #F5F7FA; background: #F7F8FB;
font-size: 14px; color: #47494E;
word-spacing: 1px;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-align: center; text-align: center;
}
.__nuxt-error-page .container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
height: 100vh; font-family: sans-serif;
margin: 0 auto; font-weight: 100 !important;
max-width: 70%; -ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
} }
.__nuxt-error-page .poweredby { .__nuxt-error-page .error {
text-align: center; max-width: 450px;
margin-top: 10%; }
.__nuxt-error-page .title {
font-size: 1.5rem;
margin-top: 15px;
color: #47494E;
margin-bottom: 8px;
}
.__nuxt-error-page .description {
color: #7F828B;
line-height: 21px;
margin-bottom: 10px;
} }
.__nuxt-error-page a { .__nuxt-error-page a {
color: #42b983 !important; color: #7F828B !important;
text-decoration: none;
}
.__nuxt-error-page .logo {
position: fixed;
right: 12px;
bottom: 12px;
} }
</style> </style>

File diff suppressed because one or more lines are too long