Skip to content

Commit 1d6254b

Browse files
authoredAug 8, 2023
fix(theme): dont show transparent navbar other than home (#2742)
1 parent b2f671a commit 1d6254b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed
 

‎src/client/theme-default/components/VPNavBar.vue

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts" setup>
22
import { useWindowScroll } from '@vueuse/core'
3-
import { computed } from 'vue'
3+
import { ref, watchPostEffect } from 'vue'
4+
import { useData } from '../composables/data'
45
import { useSidebar } from '../composables/sidebar'
56
import VPNavBarAppearance from './VPNavBarAppearance.vue'
67
import VPNavBarExtra from './VPNavBarExtra.vue'
@@ -21,11 +22,16 @@ defineEmits<{
2122
2223
const { y } = useWindowScroll()
2324
const { hasSidebar } = useSidebar()
25+
const { frontmatter } = useData()
2426
25-
const classes = computed(() => ({
26-
'has-sidebar': hasSidebar.value,
27-
fill: y.value > 0
28-
}))
27+
const classes = ref<Record<string, boolean>>({})
28+
29+
watchPostEffect(() => {
30+
classes.value = {
31+
'has-sidebar': hasSidebar.value,
32+
top: frontmatter.value?.layout === 'home' && y.value === 0,
33+
}
34+
})
2935
</script>
3036

3137
<template>
@@ -77,7 +83,7 @@ const classes = computed(() => ({
7783
padding: 0;
7884
}
7985
80-
.VPNavBar.fill:not(.has-sidebar) {
86+
.VPNavBar:not(.has-sidebar):not(.top) {
8187
border-bottom-color: var(--vp-c-gutter);
8288
background-color: var(--vp-nav-bg-color);
8389
}
@@ -162,8 +168,7 @@ const classes = computed(() => ({
162168
}
163169
164170
@media (min-width: 960px) {
165-
.VPNavBar.has-sidebar .content-body,
166-
.VPNavBar.fill .content-body {
171+
.VPNavBar:not(.top) .content-body{
167172
position: relative;
168173
background-color: var(--vp-nav-bg-color);
169174
}

0 commit comments

Comments
 (0)
Please sign in to comment.