mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 19:30:37 +01:00
docs(app): use tabs to switch framework & module (#2837)
This commit is contained in:
@@ -1,31 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { frameworks } = useSharedData()
|
const { framework, frameworks } = useSharedData()
|
||||||
|
|
||||||
|
const value = ref<string | undefined>(undefined)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
value.value = framework.value
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDropdownMenu
|
<UTabs
|
||||||
v-slot="{ open }"
|
v-model="value"
|
||||||
:modal="false"
|
|
||||||
:items="frameworks"
|
:items="frameworks"
|
||||||
:ui="{ content: 'w-(--reka-dropdown-menu-trigger-width)' }"
|
:content="false"
|
||||||
>
|
color="neutral"
|
||||||
<UButton
|
:ui="{ leadingIcon: 'group-data-[state=inactive]:grayscale' }"
|
||||||
color="neutral"
|
@update:model-value="(framework = $event as string)"
|
||||||
variant="outline"
|
/>
|
||||||
block
|
|
||||||
trailing-icon="i-lucide-chevron-down"
|
|
||||||
:class="[open && 'bg-[var(--ui-bg-elevated)]']"
|
|
||||||
:ui="{
|
|
||||||
trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : undefined].filter(Boolean).join(' ')
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<template #leading>
|
|
||||||
<UIcon v-for="framework in frameworks" :key="framework.value" :name="framework.icon" :class="`${framework.value}-only`" class="shrink-0 size-5" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<span v-for="framework in frameworks" :key="framework.value" :class="`${framework.value}-only`">
|
|
||||||
{{ framework.label }}
|
|
||||||
</span>
|
|
||||||
</UButton>
|
|
||||||
</UDropdownMenu>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ defineShortcuts({
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #content>
|
<template #content>
|
||||||
<UNavigationMenu orientation="vertical" :items="links" class="-ml-2.5" />
|
<UNavigationMenu orientation="vertical" :items="links" class="-mx-2.5" />
|
||||||
|
|
||||||
<USeparator type="dashed" class="my-4" />
|
<USeparator type="dashed" class="my-4" />
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 w-[calc(100%+1rem)] mb-4 -mx-2">
|
<div class="flex flex-col gap-2 w-[calc(100%+1.25rem)] mb-4 -mx-2.5">
|
||||||
<ModuleSelect />
|
<ModuleSelect />
|
||||||
<FrameworkSelect />
|
<FrameworkSelect />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,32 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { modules } = useSharedData()
|
const { module, modules } = useSharedData()
|
||||||
|
|
||||||
|
const value = ref<string | undefined>(undefined)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
value.value = module.value
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDropdownMenu
|
<UTabs
|
||||||
v-slot="{ open }"
|
v-model="value"
|
||||||
:modal="false"
|
|
||||||
:items="modules"
|
:items="modules"
|
||||||
:ui="{ content: 'w-(--reka-dropdown-menu-trigger-width)' }"
|
:content="false"
|
||||||
>
|
color="neutral"
|
||||||
<UButton
|
@update:model-value="(module = $event as string)"
|
||||||
color="neutral"
|
/>
|
||||||
variant="outline"
|
|
||||||
block
|
|
||||||
trailing-icon="i-lucide-chevron-down"
|
|
||||||
class="min-w-0"
|
|
||||||
:class="[open && 'bg-[var(--ui-bg-elevated)]']"
|
|
||||||
:ui="{
|
|
||||||
trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : undefined].filter(Boolean).join(' ')
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<template #leading>
|
|
||||||
<UIcon v-for="module in modules" :key="module.value" :name="module.icon" :class="`${module.value}-only`" class="shrink-0 size-5" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<span v-for="module in modules" :key="module.value" :class="`${module.value}-only`" class="truncate">
|
|
||||||
{{ module.label }}
|
|
||||||
</span>
|
|
||||||
</UButton>
|
|
||||||
</UDropdownMenu>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { createSharedComposable } from '@vueuse/core'
|
export function useSharedData() {
|
||||||
|
|
||||||
function _useSharedData() {
|
|
||||||
const framework = useCookie('nuxt-ui-framework', { default: () => 'nuxt' })
|
const framework = useCookie('nuxt-ui-framework', { default: () => 'nuxt' })
|
||||||
const frameworks = computed(() => [{
|
const frameworks = computed(() => [{
|
||||||
label: 'Nuxt',
|
label: 'Nuxt',
|
||||||
@@ -36,5 +34,3 @@ function _useSharedData() {
|
|||||||
modules
|
modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSharedData = createSharedComposable(_useSharedData)
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
|
|||||||
<template #left>
|
<template #left>
|
||||||
<UPageAside>
|
<UPageAside>
|
||||||
<template #top>
|
<template #top>
|
||||||
<div class="flex flex-col gap-2 w-[calc(100%+1rem)] -mx-2">
|
<div class="flex flex-col gap-2 w-[calc(100%+1.25rem)] -mx-2.5">
|
||||||
<ModuleSelect />
|
<ModuleSelect />
|
||||||
<FrameworkSelect />
|
<FrameworkSelect />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"@nuxt/content": "https://pkg.pr.new/@nuxt/content@c5b1a4f",
|
"@nuxt/content": "https://pkg.pr.new/@nuxt/content@c5b1a4f",
|
||||||
"@nuxt/image": "^1.8.1",
|
"@nuxt/image": "^1.8.1",
|
||||||
"@nuxt/ui": "latest",
|
"@nuxt/ui": "latest",
|
||||||
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@69c8478",
|
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@fcc00ad",
|
||||||
"@nuxthub/core": "^0.8.7",
|
"@nuxthub/core": "^0.8.7",
|
||||||
"@nuxtjs/plausible": "^1.2.0",
|
"@nuxtjs/plausible": "^1.2.0",
|
||||||
"@octokit/rest": "^21.0.2",
|
"@octokit/rest": "^21.0.2",
|
||||||
|
|||||||
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
@@ -266,8 +266,8 @@ importers:
|
|||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:..
|
version: link:..
|
||||||
'@nuxt/ui-pro':
|
'@nuxt/ui-pro':
|
||||||
specifier: https://pkg.pr.new/@nuxt/ui-pro@69c8478
|
specifier: https://pkg.pr.new/@nuxt/ui-pro@fcc00ad
|
||||||
version: https://pkg.pr.new/@nuxt/ui-pro@69c8478(magicast@0.3.5)(rollup@4.27.3)(typescript@5.6.3)
|
version: https://pkg.pr.new/@nuxt/ui-pro@fcc00ad(magicast@0.3.5)(rollup@4.27.3)(typescript@5.6.3)
|
||||||
'@nuxthub/core':
|
'@nuxthub/core':
|
||||||
specifier: ^0.8.7
|
specifier: ^0.8.7
|
||||||
version: 0.8.7(ioredis@5.4.1)(magicast@0.3.5)(rollup@4.27.3)(vite@5.4.11(@types/node@22.9.0)(lightningcss@1.28.1)(terser@5.36.0))
|
version: 0.8.7(ioredis@5.4.1)(magicast@0.3.5)(rollup@4.27.3)(vite@5.4.11(@types/node@22.9.0)(lightningcss@1.28.1)(terser@5.36.0))
|
||||||
@@ -1536,8 +1536,8 @@ packages:
|
|||||||
vitest:
|
vitest:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@69c8478':
|
'@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@fcc00ad':
|
||||||
resolution: {tarball: https://pkg.pr.new/@nuxt/ui-pro@69c8478}
|
resolution: {tarball: https://pkg.pr.new/@nuxt/ui-pro@fcc00ad}
|
||||||
version: 3.0.0-alpha.9
|
version: 3.0.0-alpha.9
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: 5.6.3
|
typescript: 5.6.3
|
||||||
@@ -1554,8 +1554,8 @@ packages:
|
|||||||
'@nuxtjs/color-mode@3.5.2':
|
'@nuxtjs/color-mode@3.5.2':
|
||||||
resolution: {integrity: sha512-cC6RfgZh3guHBMLLjrBB2Uti5eUoGM9KyauOaYS9ETmxNWBMTvpgjvSiSJp1OFljIXPIqVTJ3xtJpSNZiO3ZaA==}
|
resolution: {integrity: sha512-cC6RfgZh3guHBMLLjrBB2Uti5eUoGM9KyauOaYS9ETmxNWBMTvpgjvSiSJp1OFljIXPIqVTJ3xtJpSNZiO3ZaA==}
|
||||||
|
|
||||||
'@nuxtjs/mdc-edge@0.10.1-28888910.a0601df':
|
'@nuxtjs/mdc-edge@0.10.1-28890238.42b9f9b':
|
||||||
resolution: {integrity: sha512-I1LG9vqlw6J1rVoQci4E8Q/mjUXrmQ/gjdqc/Y2ywsY0uneEAjPou0hwhQMOKR9K3VamhQM/SVuJe6EEQITpVA==}
|
resolution: {integrity: sha512-Ix/13MucZILvZEI3h/o+RUE1psUWRSHmxNV4XHOlXqwmiyE67iqUbCdmGZ7Q8+xEiL1f6V74pCeuCCa0HkcqbQ==}
|
||||||
|
|
||||||
'@nuxtjs/plausible@1.2.0':
|
'@nuxtjs/plausible@1.2.0':
|
||||||
resolution: {integrity: sha512-pjfps32fFN77BhjqHmq2Jx4XCNso9TcYnB+S4IR2qH/c26WDfYB5mQxN5pOEiWRlMkiKq+Y45mBBFtSOVKClCA==}
|
resolution: {integrity: sha512-pjfps32fFN77BhjqHmq2Jx4XCNso9TcYnB+S4IR2qH/c26WDfYB5mQxN5pOEiWRlMkiKq+Y45mBBFtSOVKClCA==}
|
||||||
@@ -8165,7 +8165,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@libsql/client': 0.14.0
|
'@libsql/client': 0.14.0
|
||||||
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
||||||
'@nuxtjs/mdc': '@nuxtjs/mdc-edge@0.10.1-28888910.a0601df(magicast@0.3.5)(rollup@4.27.3)'
|
'@nuxtjs/mdc': '@nuxtjs/mdc-edge@0.10.1-28890238.42b9f9b(magicast@0.3.5)(rollup@4.27.3)'
|
||||||
'@sqlite.org/sqlite-wasm': 3.47.0-build1
|
'@sqlite.org/sqlite-wasm': 3.47.0-build1
|
||||||
better-sqlite3: 11.5.0
|
better-sqlite3: 11.5.0
|
||||||
c12: 2.0.1(magicast@0.3.5)
|
c12: 2.0.1(magicast@0.3.5)
|
||||||
@@ -8610,7 +8610,7 @@ snapshots:
|
|||||||
- rollup
|
- rollup
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@69c8478(magicast@0.3.5)(rollup@4.27.3)(typescript@5.6.3)':
|
'@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@fcc00ad(magicast@0.3.5)(rollup@4.27.3)(typescript@5.6.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
||||||
'@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
'@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
||||||
@@ -8798,7 +8798,7 @@ snapshots:
|
|||||||
- rollup
|
- rollup
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@nuxtjs/mdc-edge@0.10.1-28888910.a0601df(magicast@0.3.5)(rollup@4.27.3)':
|
'@nuxtjs/mdc-edge@0.10.1-28890238.42b9f9b(magicast@0.3.5)(rollup@4.27.3)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
'@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.27.3)
|
||||||
'@shikijs/transformers': 1.24.0
|
'@shikijs/transformers': 1.24.0
|
||||||
|
|||||||
Reference in New Issue
Block a user