docs: new structure (#1282)

Co-authored-by: Sébastien Chopin <seb@nuxt.com>
This commit is contained in:
Benjamin Canac
2024-01-30 11:24:02 +01:00
committed by GitHub
parent 20ac4b3332
commit e92be71749
206 changed files with 1725 additions and 1851 deletions

View File

@@ -4,27 +4,59 @@ export const useContentSource = () => {
const config = useRuntimeConfig().public
const branches = computed(() => [{
id: 'dev',
name: 'dev',
icon: 'i-heroicons-cube',
suffix: 'dev',
label: 'Edge',
disabled: route.path.startsWith('/dev'),
click: () => select({ name: 'dev' })
}, {
id: 'main',
name: 'main',
label: 'nuxt/ui',
icon: 'i-heroicons-cube',
suffix: 'latest',
label: `v${config.version}`,
disabled: !route.path.startsWith('/dev'),
suffix: `v${config.version}`,
click: () => select({ name: 'main' })
}, {
id: 'dev',
name: 'dev',
label: 'nuxt/ui-edge',
icon: 'i-heroicons-cube-transparent',
suffix: 'dev',
click: () => select({ name: 'dev' })
}, {
id: 'pro',
name: 'pro',
label: 'nuxt/ui-pro',
icon: 'i-heroicons-cube',
suffix: `v${config.proVersion}`,
click: () => select({ name: 'pro' })
}, {
id: 'pro-edge',
name: 'pro-edge',
label: 'nuxt/ui-pro-edge',
icon: 'i-heroicons-cube-transparent',
suffix: 'dev',
disabled: true,
click: () => select({ name: 'pro-dev' })
}])
const branch = computed(() => branches.value.find(b => b.name === (route.path.startsWith('/dev') ? 'dev' : 'main')))
const branch = computed(() => branches.value.find(b => b.name === (route.path.startsWith('/dev') ? 'dev' : route.path.startsWith('/pro') ? 'pro' : 'main')))
function select (branch) {
if (branch.name === 'dev') {
function select (b) {
if (b.name === branch.value.name) {
return
}
if (b.name === 'pro') {
router.push('/pro/getting-started')
return
}
if (branch.value.name === 'pro') {
if (b.name === 'dev') {
router.push('/dev/getting-started')
} else {
router.push('/getting-started')
}
return
}
if (b.name === 'dev') {
if (route.path.startsWith('/dev')) {
return
}
@@ -37,7 +69,6 @@ export const useContentSource = () => {
return {
branches,
branch,
select
branch
}
}