feat(theme): add NotFound component

This commit is contained in:
pengzhanbo 2023-02-14 04:55:01 +08:00
parent 9c3d5c4b5c
commit 0d0db5f14f

View File

@ -1,3 +1,93 @@
<script setup lang="ts">
import { useSiteLocaleData, withBase } from '@vuepress/client'
import { onMounted, ref } from 'vue'
const site = useSiteLocaleData()
const root = ref('/')
// onMounted(() => {
// const path = window.location.pathname
// .replace(site.value.base, '')
// .replace(/(^.*?\/).*$/, '/$1')
// })
</script>
<template>
<div>404</div>
<div class="not-found">
<p class="code">404</p>
<h1 class="title">PAGE NOT FOUND</h1>
<div class="divider" />
<blockquote class="quote">
But if you don't change your direction, and if you keep looking, you may
end up where you are heading.
</blockquote>
<div class="action">
<a class="link" :href="withBase(root)" aria-label="go to home">
Take me home
</a>
</div>
</div>
</template>
<style scoped>
.not-found {
padding: 64px 24px 96px;
text-align: center;
}
@media (min-width: 768px) {
.not-found {
padding: 96px 32px 168px;
}
}
.code {
line-height: 64px;
font-size: 64px;
font-weight: 600;
}
.title {
padding-top: 12px;
letter-spacing: 2px;
line-height: 20px;
font-size: 20px;
font-weight: 700;
}
.divider {
margin: 24px auto 18px;
width: 64px;
height: 1px;
background-color: var(--vp-c-divider);
}
.quote {
margin: 0 auto;
max-width: 256px;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-text-2);
}
.action {
padding-top: 20px;
}
.link {
display: inline-block;
border: 1px solid var(--vp-c-brand);
border-radius: 16px;
padding: 3px 16px;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-brand);
transition: border-color 0.25s, color 0.25s;
}
.link:hover {
border-color: var(--vp-c-brand-dark);
color: var(--vp-c-brand-dark);
}
</style>