Skip to content

Commit e0c8838

Browse files
committed
wip: migrate to content v3
1 parent 4983f30 commit e0c8838

File tree

114 files changed

+1590
-1424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1590
-1424
lines changed

app/components/Docs/Footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
const { data: surround } = await useAsyncData("surround", () =>
4141
queryCollectionItemSurroundings("content", route.path, {
4242
fields: ["title", "description", "path"],
43-
})
43+
}).where("path", "NOT LIKE", "%/.navigation")
4444
);
4545
const prev = computed(() => surround.value?.[0]);
4646
const next = computed(() => surround.value?.[1]);

app/components/Docs/Header.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
2-
<div>
3-
<h1 class="mb-0 text-4xl">{{ page?.title }}</h1>
4-
<p v-if="page?.description" class="text-lg text-muted-foreground">{{ page?.description }}</p>
2+
<div class="not-prose">
3+
<UiBreadcrumbs :items="items" class="mb-6" />
4+
<h1 class="text-4xl font-bold leading-none">{{ page?.title }}</h1>
5+
<p v-if="page?.description" class="mb-6 mt-3 text-lg text-muted-foreground">
6+
{{ page?.description }}
7+
</p>
58
<div v-if="page?.links && page?.links?.length" class="not-prose flex flex-wrap gap-2">
69
<template v-for="(link, i) in page?.links" :key="i">
710
<a
@@ -20,7 +23,16 @@
2023
</template>
2124

2225
<script lang="ts" setup>
23-
defineProps<{
24-
page: any;
26+
import { compact, startCase } from "lodash-es";
27+
import type { ContentCollectionItem } from "@nuxt/content";
28+
29+
const props = defineProps<{
30+
page: ContentCollectionItem;
2531
}>();
32+
33+
const items = computed(() => {
34+
const starting = startCase(compact(props.page?.path?.split("/"))[0] || "");
35+
const title = startCase(props.page?.title || "");
36+
return [{ label: starting }, { label: title }];
37+
});
2638
</script>

app/components/Docs/Nav.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
exact-active-class="underline underline-offset-2 text-primary"
88
:to="l.path"
99
:title="l.title"
10+
@click="mobileNavState = false"
1011
>
1112
{{ l.title }}
1213
</NuxtLink>
13-
<UiBadge v-if="l.label" class="px-2 py-0 text-[10px] dark:bg-lime-500">{{
14-
l.label
15-
}}</UiBadge>
14+
<UiBadge
15+
v-if="l.label"
16+
class="rounded-md px-2 py-0 text-xs dark:bg-lime-500 md:rounded-full md:text-[10px]"
17+
>{{ l.label }}</UiBadge
18+
>
1619
</div>
1720
<div v-else class="flex flex-col gap-4">
1821
<div class="flex items-center gap-2.5">
@@ -40,4 +43,6 @@
4043
const styles = tv({
4144
base: "flex flex-col gap-6 sm:text-sm",
4245
});
46+
47+
const mobileNavState = useMobileNavState();
4348
</script>

app/components/Mainnav.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
size="icon-sm"
88
variant="outline"
99
class="h-9 w-9 lg:hidden"
10-
@click="mobileNav = true"
10+
@click="mobileNavState = true"
1111
><Icon name="heroicons:bars-2" class="h-4 w-4" />
1212
</UiButton>
1313
<NuxtLink to="/" class="text-lg font-bold">UI Thing</NuxtLink>
@@ -118,7 +118,7 @@
118118
</UiDropdownMenu>
119119
</div>
120120
</div>
121-
<MobileNav v-model="mobileNav" />
121+
<MobileNav />
122122
</header>
123123
</template>
124124

@@ -131,7 +131,7 @@
131131
132132
const route = useRoute();
133133
134-
const mobileNav = ref(false);
134+
const mobileNavState = useMobileNavState();
135135
136136
const colorMode = useColorMode();
137137
const setTheme = (val: string) => {

app/components/MobileNav.vue

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,34 @@
11
<template>
2-
<UiSheet v-model:open="localModel">
3-
<UiSheetContent class="p-1">
4-
<template #content>
5-
<UiSheetTitle title="Mobile menu" class="sr-only" />
6-
<UiSheetDescription description="A list of navigation items for mobile" class="sr-only" />
7-
<UiScrollArea class="h-[calc(100dvh-20px)] w-full p-5">
8-
<div class="sticky top-0 mb-3 w-full bg-background">
9-
<div class="flex items-center gap-3.5">
10-
<div class="flex h-8 w-8 items-center justify-center rounded bg-foreground/10">
11-
<DocsLogo />
12-
</div>
13-
<p class="text-xl font-bold">UI Thing</p>
14-
<UiSheetClose class="ml-auto">
15-
<Icon name="lucide:x" />
16-
</UiSheetClose>
17-
</div>
18-
<UiSeparator class="mt-4" />
19-
</div>
20-
<DocsNav :links="navigation" />
21-
</UiScrollArea>
2+
<UiDrawer v-model:open="mobileNavState" should-scale-background>
3+
<UiDrawerContent class="h-[600px]">
4+
<template #knob>
5+
<div
6+
class="mx-auto my-5 h-1 w-[60px] shrink-0 cursor-grab rounded-full bg-muted active:cursor-grabbing"
7+
/>
228
</template>
23-
</UiSheetContent>
24-
</UiSheet>
9+
<div>
10+
<UiDrawerTitle class="sr-only mb-1.5">Mobile Menu</UiDrawerTitle>
11+
<UiDrawerDescription class="sr-only">
12+
A list of navigation items for mobile
13+
</UiDrawerDescription>
14+
15+
<div class="relative h-[calc(100dvh-230px)] overflow-y-auto pl-6 pr-2">
16+
<DocsNav :links="navigation" @clicked="mobileNavState = false" />
17+
</div>
18+
19+
<UiDrawerClose class="absolute right-4 top-3 h-7 w-7" as-child>
20+
<UiButton variant="ghost" size="icon-sm" class="opacity-50 hover:opacity-100">
21+
<Icon name="lucide:x" />
22+
</UiButton>
23+
</UiDrawerClose>
24+
</div>
25+
</UiDrawerContent>
26+
</UiDrawer>
2527
</template>
2628

2729
<script lang="ts" setup>
2830
import type { ContentNavigationItem } from "@nuxt/content";
2931
3032
const navigation = inject<Ref<ContentNavigationItem[]>>("navigation", ref([]));
31-
32-
const props = defineProps<{
33-
modelValue?: boolean;
34-
}>();
35-
const emits = defineEmits<{
36-
"update:modelValue": [value: boolean];
37-
}>();
38-
39-
const localModel = useVModel(props, "modelValue", emits, { passive: true });
33+
const mobileNavState = useMobileNavState();
4034
</script>

app/components/content/Block/BlockShowcase.vue

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,42 @@
1616
}
1717
"
1818
>
19-
<UiToggleGroupItem class="size-6 rounded-sm p-0" value="100">
19+
<UiToggleGroupItem v-tippy="'Desktop View'" class="size-6 rounded-sm p-0" value="100">
2020
<Icon class="size-3.5" name="lucide:monitor" />
2121
</UiToggleGroupItem>
22-
<UiToggleGroupItem class="size-6 rounded-sm p-0" value="60">
22+
<UiToggleGroupItem v-tippy="'Tablet View'" class="size-6 rounded-sm p-0" value="60">
2323
<Icon class="size-3.5" name="lucide:tablet" />
2424
</UiToggleGroupItem>
25-
<UiToggleGroupItem value="40" class="size-6 rounded-sm p-0">
25+
<UiToggleGroupItem v-tippy="'Mobile View'" value="40" class="size-6 rounded-sm p-0">
2626
<Icon class="size-3.5" name="lucide:smartphone" />
2727
</UiToggleGroupItem>
2828
</UiToggleGroup>
2929
</div>
3030
<div class="flex items-center gap-3">
31-
<UiTooltip v-if="externalViewLink">
32-
<UiTooltipTrigger as-child>
33-
<UiButton
34-
target="_blank"
35-
:href="externalViewLink"
36-
class="size-8 rounded-md"
37-
size="icon-sm"
38-
variant="outline"
39-
>
40-
<Icon name="lucide:square-arrow-out-up-right" class="size-3.5" />
41-
</UiButton>
42-
</UiTooltipTrigger>
43-
<UiTooltipContent align="center">External view</UiTooltipContent>
44-
</UiTooltip>
45-
<UiTooltip v-if="codeBlock">
46-
<UiTooltipTrigger as-child>
47-
<UiButton
48-
class="size-8 rounded-md"
49-
size="icon-sm"
50-
variant="outline"
51-
@click="copy(codeBlock)"
52-
>
53-
<Icon :name="copied ? 'lucide:check' : 'lucide:copy'" class="size-3.5" />
54-
</UiButton>
55-
</UiTooltipTrigger>
56-
<UiTooltipContent align="center">Click to copy the source code</UiTooltipContent>
57-
</UiTooltip>
31+
<UiButton
32+
v-if="externalViewLink"
33+
v-tippy="'External View'"
34+
target="_blank"
35+
:href="externalViewLink"
36+
class="size-8 rounded-md"
37+
size="icon-sm"
38+
variant="outline"
39+
>
40+
<Icon name="lucide:square-arrow-out-up-right" class="size-3.5" />
41+
<span class="sr-only">External View</span>
42+
</UiButton>
43+
44+
<UiButton
45+
v-if="codeBlock"
46+
v-tippy="'Copy Source Code'"
47+
class="size-8 rounded-md"
48+
size="icon-sm"
49+
variant="outline"
50+
@click="copy(codeBlock)"
51+
>
52+
<Icon :name="copied ? 'lucide:check' : 'lucide:copy'" class="size-3.5" />
53+
<span class="sr-only">Copy Source Code</span>
54+
</UiButton>
5855
</div>
5956
</div>
6057

@@ -118,8 +115,7 @@
118115
import: "default",
119116
});
120117
const path = blockImports[`./${props.blockPath}.vue`];
121-
codeBlock.value = await path();
122-
118+
codeBlock.value = (await path?.()) ?? null;
123119
isLoading.value = false;
124120
};
125121

app/components/content/Docs/DocsSeparator.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)