docs: improve multi-source handling (#682)

This commit is contained in:
Benjamin Canac
2023-09-15 14:37:53 +02:00
committed by GitHub
parent 81463cd21d
commit 8ec23c042d
10 changed files with 128 additions and 201 deletions

View File

@@ -10,7 +10,7 @@
color="gray"
:ui="{ icon: { trailing: { padding: { sm: 'pe-1.5' } } } }"
:ui-menu="{ option: { container: 'gap-1.5' } }"
@update:model-value="selectBranch"
@update:model-value="select"
>
<template #label>
<UIcon v-if="branch.icon" :name="branch.icon" class="w-4 h-4 flex-shrink-0 text-gray-600 dark:text-gray-300" />
@@ -32,19 +32,5 @@
</template>
<script setup lang="ts">
const route = useRoute()
const router = useRouter()
const { branches, branch } = useContentSource()
function selectBranch (branch) {
if (branch.name === 'dev') {
if (route.path.startsWith('/dev')) {
return
}
router.push(`/dev${route.path}`)
} else {
router.push(route.path.replace('/dev', ''))
}
}
const { branches, branch, select } = useContentSource()
</script>

View File

@@ -19,7 +19,7 @@
<UDocsSearchButton icon-only />
</UTooltip>
<UColorModeButton v-if="!$colorMode.forced" />
<UColorModeButton />
<USocialButton to="https://github.com/nuxt/ui" target="_blank" icon="i-simple-icons-github" aria-label="GitHub" class="hidden lg:inline-flex" />
</template>