Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9ab0ec8

Browse filesBrowse files
committed
feat: show docs link for components
1 parent 807405f commit 9ab0ec8
Copy full SHA for 9ab0ec8

File tree

4 files changed

+35
-5
lines changed
Filter options

4 files changed

+35
-5
lines changed

‎packages/devtools/client/components/ComponentDetails.vue

Copy file name to clipboardExpand all lines: packages/devtools/client/components/ComponentDetails.vue
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ const copy = useCopy()
1919

2020
<template>
2121
<div flex="~ col gap1" items-start of-hidden>
22-
<div flex="~ gap2" px3>
22+
<div flex="~ gap2 items-center" px3>
2323
<ComponentName :component="component" />
2424
<NButton
25-
title="Copy name" flex-none icon="carbon-copy" :border="false"
25+
v-if="component.meta?.docs && typeof component.meta.docs === 'string'"
26+
title="Open docs" flex-none n="xs"
27+
:to="component.meta.docs" target="_blank"
28+
icon="carbon-catalog"
29+
>
30+
Docs
31+
</NButton>
32+
<NButton
33+
title="Copy name" flex-none n="xs"
34+
icon="carbon-copy"
2635
@click="copy(`<${name}></${name}>`, 'component-name')"
27-
/>
36+
>
37+
Copy
38+
</NButton>
2839
<NBadge
2940
v-if="component.global"
3041
n="green"

‎packages/devtools/client/components/ComponentItem.vue

Copy file name to clipboardExpand all lines: packages/devtools/client/components/ComponentItem.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const filePath = computed(() => props.component.filePath || props.component.file
2828
:component="component"
2929
:dependencies="dependencies"
3030
:dependents="dependents"
31-
w-100 pt4
31+
w-100 pt3
3232
/>
3333
</template>
3434
</VDropdown>

‎packages/devtools/client/components/ComponentsGraph.vue

Copy file name to clipboardExpand all lines: packages/devtools/client/components/ComponentsGraph.vue
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function setFilter() {
291291
border="t l base" w-80
292292
@close="onCloseDrawer"
293293
>
294-
<div v-if="selected && selected.component" py4 pt4 flex="~ col">
294+
<div v-if="selected && selected.component" py4 pt3 flex="~ col">
295295
<ComponentDetails
296296
:component="selected.component"
297297
:dependencies="selectedDependencies"

‎packages/devtools/client/components/ComponentsList.vue

Copy file name to clipboardExpand all lines: packages/devtools/client/components/ComponentsList.vue
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ const componentWithRelationships = computed(() => {
2424
return components
2525
})
2626
27+
const builtinComponentDocs = {
28+
ClientOnly: 'https://nuxt.com/docs/api/components/client-only',
29+
DevOnly: 'https://nuxt.com/docs/api/components/dev-only',
30+
NuxtClientFallback: 'https://nuxt.com/docs/api/components/nuxt-client-fallback',
31+
NuxtPicture: 'https://nuxt.com/docs/api/components/nuxt-picture',
32+
NuxtRouteAnnouncer: 'https://nuxt.com/docs/api/components/nuxt-route-announcer',
33+
NuxtTime: 'https://nuxt.com/docs/api/components/nuxt-time',
34+
NuxtPage: 'https://nuxt.com/docs/api/components/nuxt-page',
35+
NuxtLayout: 'https://nuxt.com/docs/api/components/nuxt-layout',
36+
NuxtLink: 'https://nuxt.com/docs/api/components/nuxt-link',
37+
NuxtLoadingIndicator: 'https://nuxt.com/docs/api/components/nuxt-loading-indicator',
38+
NuxtErrorBoundary: 'https://nuxt.com/docs/api/components/nuxt-error-boundary',
39+
NuxtWelcome: 'https://nuxt.com/docs/api/components/nuxt-welcome',
40+
NuxtIsland: 'https://nuxt.com/docs/api/components/nuxt-island',
41+
NuxtImg: 'https://nuxt.com/docs/api/components/nuxt-img',
42+
}
43+
2744
const fuse = computed(() => new Fuse(componentWithRelationships.value, {
2845
keys: [
2946
'component.pascalName',
@@ -57,6 +74,8 @@ const filtered = computed(() => {
5774
if (!name)
5875
return
5976
if (name === 'nuxt') {
77+
c.meta ??= {}
78+
c.meta.docs ??= builtinComponentDocs?.[c.pascalName as keyof typeof builtinComponentDocs]
6079
builtin.push(component)
6180
count.builtin++
6281
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.