fix(theme): dont show transparent navbar other than home (#2742)

pull/2753/head
Divyansh Singh 1 year ago committed by GitHub
parent b2f671ab3b
commit 1d6254b615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useWindowScroll } from '@vueuse/core' 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 { useSidebar } from '../composables/sidebar'
import VPNavBarAppearance from './VPNavBarAppearance.vue' import VPNavBarAppearance from './VPNavBarAppearance.vue'
import VPNavBarExtra from './VPNavBarExtra.vue' import VPNavBarExtra from './VPNavBarExtra.vue'
@ -21,11 +22,16 @@ defineEmits<{
const { y } = useWindowScroll() const { y } = useWindowScroll()
const { hasSidebar } = useSidebar() const { hasSidebar } = useSidebar()
const { frontmatter } = useData()
const classes = computed(() => ({ const classes = ref<Record<string, boolean>>({})
'has-sidebar': hasSidebar.value,
fill: y.value > 0 watchPostEffect(() => {
})) classes.value = {
'has-sidebar': hasSidebar.value,
top: frontmatter.value?.layout === 'home' && y.value === 0,
}
})
</script> </script>
<template> <template>
@ -77,7 +83,7 @@ const classes = computed(() => ({
padding: 0; padding: 0;
} }
.VPNavBar.fill:not(.has-sidebar) { .VPNavBar:not(.has-sidebar):not(.top) {
border-bottom-color: var(--vp-c-gutter); border-bottom-color: var(--vp-c-gutter);
background-color: var(--vp-nav-bg-color); background-color: var(--vp-nav-bg-color);
} }
@ -162,8 +168,7 @@ const classes = computed(() => ({
} }
@media (min-width: 960px) { @media (min-width: 960px) {
.VPNavBar.has-sidebar .content-body, .VPNavBar:not(.top) .content-body{
.VPNavBar.fill .content-body {
position: relative; position: relative;
background-color: var(--vp-nav-bg-color); background-color: var(--vp-nav-bg-color);
} }

Loading…
Cancel
Save