Skip to content

Commit 1bbbc83

Browse files
sapphi-redbluwy
andcommitted
docs: show old document warning (vitejs#18805)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
1 parent 5936352 commit 1bbbc83

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div class="old-document">
3+
<p>
4+
This documentation covers Vite 5 <strong>(old version)</strong>. For the
5+
latest version, see
6+
<a href="https://vite.dev" class="new-document-link">https://vite.dev</a>.
7+
</p>
8+
</div>
9+
</template>
10+
11+
<style>
12+
:root {
13+
--vp-layout-top-height: 96px;
14+
@media (min-width: 455px) {
15+
--vp-layout-top-height: 64px;
16+
}
17+
@media (min-width: 960px) {
18+
--vp-layout-top-height: 32px;
19+
}
20+
}
21+
22+
.old-document {
23+
position: fixed;
24+
display: flex;
25+
height: var(--vp-layout-top-height);
26+
width: 100%;
27+
padding: 4px 32px;
28+
justify-content: center;
29+
align-items: center;
30+
color: var(--vp-c-text-1);
31+
background: var(--vp-c-brand-lightest);
32+
z-index: var(--vp-z-index-layout-top);
33+
34+
.new-document-link {
35+
text-decoration: underline;
36+
color: var(--vp-c-text-1);
37+
&:hover {
38+
color: var(--vp-c-text-2);
39+
}
40+
}
41+
}
42+
.dark {
43+
.old-document {
44+
background: var(--vp-c-brand-darker);
45+
}
46+
}
47+
</style>

docs/.vitepress/theme/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import Theme from 'vitepress/theme'
22
import { h } from 'vue'
33
import SponsorsSidebar from './SponsorsSidebar.vue'
4+
import OldDocument from './components/OldDocument.vue'
45
import './custom.css'
56

67
export default {
78
...Theme,
89
Layout() {
910
return h(Theme.Layout, null, {
11+
'layout-top': () => h(OldDocument),
1012
'sidebar-bottom': () =>
1113
h('div', { class: 'sponsors sidebar' }, [h(SponsorsSidebar)])
1214
})

0 commit comments

Comments
 (0)