Warp/node_modules/vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue

53 lines
997 B
Vue
Raw Permalink Normal View History

2024-01-05 12:14:38 +00:00
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { useData } from '../composables/data'
import { isActive } from '../../shared'
import VPLink from './VPLink.vue'
defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const { page } = useData()
</script>
<template>
<VPLink
:class="{
VPNavBarMenuLink: true,
active: isActive(
page.relativePath,
item.activeMatch || item.link,
!!item.activeMatch
)
}"
:href="item.link"
:target="item.target"
:rel="item.rel"
tabindex="0"
>
<span v-html="item.text"></span>
</VPLink>
</template>
<style scoped>
.VPNavBarMenuLink {
display: flex;
align-items: center;
padding: 0 12px;
line-height: var(--vp-nav-height);
font-size: 14px;
font-weight: 500;
color: var(--vp-c-text-1);
transition: color 0.25s;
}
.VPNavBarMenuLink.active {
color: var(--vp-c-brand-1);
}
.VPNavBarMenuLink:hover {
color: var(--vp-c-brand-1);
}
</style>