Skip to content

Commit

Permalink
fix(theme): dont show transparent navbar other than home (#2742)
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Aug 8, 2023
1 parent b2f671a commit 1d6254b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/client/theme-default/components/VPNavBar.vue
@@ -1,6 +1,7 @@
<script lang="ts" setup>
import { useWindowScroll } from '@vueuse/core'
import { computed } from 'vue'
import { ref, watchPostEffect } from 'vue'
import { useData } from '../composables/data'
import { useSidebar } from '../composables/sidebar'
import VPNavBarAppearance from './VPNavBarAppearance.vue'
import VPNavBarExtra from './VPNavBarExtra.vue'
Expand All @@ -21,11 +22,16 @@ defineEmits<{
const { y } = useWindowScroll()
const { hasSidebar } = useSidebar()
const { frontmatter } = useData()
const classes = computed(() => ({
'has-sidebar': hasSidebar.value,
fill: y.value > 0
}))
const classes = ref<Record<string, boolean>>({})
watchPostEffect(() => {
classes.value = {
'has-sidebar': hasSidebar.value,
top: frontmatter.value?.layout === 'home' && y.value === 0,
}
})
</script>

<template>
Expand Down Expand Up @@ -77,7 +83,7 @@ const classes = computed(() => ({
padding: 0;
}
.VPNavBar.fill:not(.has-sidebar) {
.VPNavBar:not(.has-sidebar):not(.top) {
border-bottom-color: var(--vp-c-gutter);
background-color: var(--vp-nav-bg-color);
}
Expand Down Expand Up @@ -162,8 +168,7 @@ const classes = computed(() => ({
}
@media (min-width: 960px) {
.VPNavBar.has-sidebar .content-body,
.VPNavBar.fill .content-body {
.VPNavBar:not(.top) .content-body{
position: relative;
background-color: var(--vp-nav-bg-color);
}
Expand Down

0 comments on commit 1d6254b

Please sign in to comment.