-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
276 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,78 @@ | ||
<script lang="ts" setup> | ||
import VPMenuLink from 'vitepress/dist/client/theme-default/components/VPMenuLink.vue' | ||
import VPMenuLink from './VPMenuLink.vue'; | ||
defineProps<{ | ||
text?: string | ||
items: any[] | ||
}>() | ||
text?: string; | ||
items: any[]; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div class="VPMenuGroup"> | ||
<p v-if="text" class="title">{{ text }}</p> | ||
<p | ||
v-if="text" | ||
class="title" | ||
> | ||
{{ text }} | ||
</p> | ||
|
||
<template v-for="item in items"> | ||
<VPMenuLink v-if="'link' in item" :item="item" /> | ||
<VPMenuGroup class="VPMenuGroupItem" v-else :text="item.text" :items="item.items" /> | ||
<div class="VPMenuGroupContainer"> | ||
<VPMenuLink | ||
v-if="'link' in item" | ||
:item="item" | ||
/> | ||
<VPMenuGroup | ||
class="VPMenuGroupItem" | ||
v-else | ||
:text="item.text" | ||
:items="item.items" | ||
/> | ||
</div> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.VPMenuGroup { | ||
margin: 12px -12px 0; | ||
border-top: 1px solid var(--vp-c-divider-light); | ||
padding: 12px 12px 0; | ||
border-top: 1px solid var(--vp-c-divider); | ||
padding: 12px 12px 0 20px; | ||
} | ||
.VPMenuGroupItem{ | ||
.VPMenuGroupContainer { | ||
border-left: 1px solid var(--vp-c-divider); | ||
margin-left: 5px; | ||
} | ||
.VPMenuGroupContainer+.VPMenuGroupContainer{ | ||
padding-top: 5px; | ||
} | ||
.VPMenuGroupItem { | ||
border-top: 0; | ||
margin-left: 12px; | ||
margin-top: -8px; | ||
margin-left: 16px; | ||
margin-top: 0; | ||
padding-left: 0; | ||
} | ||
.VPMenuGroup:first-child { | ||
margin-top: 0; | ||
border-top: 0; | ||
padding-top: 0; | ||
} | ||
.VPMenuGroup + .VPMenuGroup { | ||
margin-top: 12px; | ||
border-top: 1px solid var(--vp-c-divider-light); | ||
/* margin-top: 12px; */ | ||
border-top: 1px solid var(--vp-c-divider); | ||
} | ||
.title { | ||
padding: 0 12px; | ||
margin-left: 5px; | ||
line-height: 32px; | ||
font-size: 14px; | ||
font-weight: 600; | ||
font-weight: bold; | ||
color: var(--vp-c-text-2); | ||
transition: color 0.25s; | ||
white-space: nowrap; | ||
transition: color 0.25s; | ||
user-select: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<script lang="ts" setup> | ||
import type { DefaultTheme } from 'vitepress/theme'; | ||
import { useData } from 'vitepress'; | ||
import { isActive } from 'vitepress/dist/client/shared'; | ||
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'; | ||
defineProps<{ | ||
item: DefaultTheme.NavItemWithLink; | ||
}>(); | ||
const { page } = useData(); | ||
</script> | ||
|
||
<template> | ||
<div class="VPMenuLink"> | ||
<VPLink | ||
:class="{ | ||
active: isActive( | ||
page.relativePath, | ||
item.activeMatch || item.link, | ||
!!item.activeMatch | ||
) | ||
}" | ||
:href="item.link" | ||
:target="item.target" | ||
:rel="item.rel" | ||
> | ||
{{ item.text }} | ||
</VPLink> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.VPMenuGroup + .VPMenuLink { | ||
margin: 0 -16px 0 16px; | ||
padding: 12px 16px 0 0px; | ||
} | ||
.link { | ||
margin-left: 8px; | ||
display: block; | ||
border-radius: 6px; | ||
padding: 0 12px; | ||
line-height: 32px; | ||
font-size: 12px; | ||
font-weight: normal; | ||
color: var(--vp-c-text-1); | ||
white-space: nowrap; | ||
transition: background-color 0.25s, color 0.25s; | ||
} | ||
.VPMenuGroup + .VPMenuLink .link { | ||
margin-left: 0px; | ||
padding-left: 0; | ||
} | ||
.link:hover { | ||
color: var(--vp-c-brand-1); | ||
background-color: var(--vp-c-default-soft); | ||
} | ||
.link.active { | ||
color: var(--vp-c-brand-1); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 26 additions & 13 deletions
39
example/.vitepress/theme/components/VPNavBarMenuGroup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.