mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-07 19:14:11 +08:00
refactor: say good night to YukiReflection
This commit is contained in:
38
docs-source/src/.vuepress/client.ts
Normal file
38
docs-source/src/.vuepress/client.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { defineClientConfig } from '@vuepress/client'
|
||||
import { h, onMounted, watch } from 'vue'
|
||||
import DeprecatedBanner from './components/DeprecatedBanner.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
export default defineClientConfig({
|
||||
rootComponents: [
|
||||
() => h(DeprecatedBanner)
|
||||
],
|
||||
setup() {
|
||||
const route = useRoute()
|
||||
|
||||
const adjustLayout = () => {
|
||||
requestAnimationFrame(() => {
|
||||
const banner = document.querySelector('.deprecated-banner') as HTMLElement
|
||||
const height = banner?.clientHeight ?? 0
|
||||
|
||||
const themeContainer = document.querySelector('.theme-container') as HTMLElement
|
||||
const navbar = document.querySelector('.navbar') as HTMLElement
|
||||
const sidebar = document.querySelector('.sidebar') as HTMLElement
|
||||
|
||||
if (height > 0) {
|
||||
if (themeContainer) themeContainer.style.paddingTop = `${height}px`
|
||||
if (navbar) navbar.style.marginTop = `${height}px`
|
||||
if (sidebar) sidebar.style.marginTop = `${height}px`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
adjustLayout()
|
||||
})
|
||||
|
||||
watch(() => route.path, () => {
|
||||
adjustLayout()
|
||||
})
|
||||
}
|
||||
})
|
35
docs-source/src/.vuepress/components/DeprecatedBanner.vue
Normal file
35
docs-source/src/.vuepress/components/DeprecatedBanner.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="deprecated-banner">
|
||||
YukiReflection is deprecated, Start trying <a href="https://github.com/HighCapable/KavaRef" target="_blank"
|
||||
rel="noopener">KavaRef</a> now! 
|
||||
YukiReflection 已被弃用,立即尝试 <a href="https://github.com/HighCapable/KavaRef/blob/main/README-zh-CN.md"
|
||||
target="_blank" rel="noopener">KavaRef</a> 吧!
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.deprecated-banner {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #ffdddd;
|
||||
color: #a00000;
|
||||
text-align: center;
|
||||
padding: 12px 24px;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
z-index: 9999;
|
||||
|
||||
}
|
||||
|
||||
.deprecated-banner a {
|
||||
color: #a00000;
|
||||
text-decoration: underline;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.deprecated-banner a:hover {
|
||||
color: #600000;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user