mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 03:10:42 +01:00
docs(Header): add GitHub link in mobile menu (#3721)
This commit is contained in:
@@ -22,8 +22,20 @@ onMounted(() => {
|
|||||||
|
|
||||||
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
|
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
|
||||||
|
|
||||||
|
const githubLink = computed(() => {
|
||||||
|
return `https://github.com/nuxt/${value.value}`
|
||||||
|
})
|
||||||
|
|
||||||
const desktopLinks = computed(() => props.links.map(({ icon, ...link }) => link))
|
const desktopLinks = computed(() => props.links.map(({ icon, ...link }) => link))
|
||||||
const mobileLinks = computed(() => props.links.map(link => ({ ...link, defaultOpen: link.children && route.path.startsWith(link.to as string) })))
|
const mobileLinks = computed(() => [
|
||||||
|
...props.links.map(link => ({ ...link, defaultOpen: link.children && route.path.startsWith(link.to as string) })),
|
||||||
|
{
|
||||||
|
label: 'Open on GitHub',
|
||||||
|
to: githubLink.value,
|
||||||
|
icon: 'i-simple-icons-github',
|
||||||
|
target: '_blank'
|
||||||
|
}
|
||||||
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -73,7 +85,7 @@ const mobileLinks = computed(() => props.links.map(link => ({ ...link, defaultOp
|
|||||||
:key="value"
|
:key="value"
|
||||||
color="neutral"
|
color="neutral"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
:to="`https://github.com/nuxt/${value}`"
|
:to="githubLink"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
icon="i-simple-icons-github"
|
icon="i-simple-icons-github"
|
||||||
aria-label="GitHub"
|
aria-label="GitHub"
|
||||||
|
|||||||
Reference in New Issue
Block a user