|
|
|
@ -1,16 +1,29 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { provide } from 'vue'
|
|
|
|
|
import { inBrowser } from 'vitepress'
|
|
|
|
|
import { computed, provide, watchEffect } from 'vue'
|
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
|
import { useNav } from '../composables/nav'
|
|
|
|
|
import VPNavBar from './VPNavBar.vue'
|
|
|
|
|
import VPNavScreen from './VPNavScreen.vue'
|
|
|
|
|
|
|
|
|
|
const { isScreenOpen, closeScreen, toggleScreen } = useNav()
|
|
|
|
|
const { frontmatter } = useData()
|
|
|
|
|
|
|
|
|
|
const hasNavbar = computed(() => {
|
|
|
|
|
return frontmatter.value.navbar !== false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
provide('close-screen', closeScreen)
|
|
|
|
|
|
|
|
|
|
watchEffect(() => {
|
|
|
|
|
if (inBrowser) {
|
|
|
|
|
document.documentElement.classList.toggle('hide-nav', !hasNavbar.value)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<header class="VPNav">
|
|
|
|
|
<header v-if="hasNavbar" class="VPNav">
|
|
|
|
|
<VPNavBar :is-screen-open="isScreenOpen" @toggle-screen="toggleScreen">
|
|
|
|
|
<template #nav-bar-title-before><slot name="nav-bar-title-before" /></template>
|
|
|
|
|
<template #nav-bar-title-after><slot name="nav-bar-title-after" /></template>
|
|
|
|
|