mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 00:15:05 +01:00
docs: new structure (#1282)
Co-authored-by: Sébastien Chopin <seb@nuxt.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user