Skip to content

Commit b77b98b

Browse files
authored
feat(ui): NNavbar component (#442)
1 parent 901cdff commit b77b98b

File tree

10 files changed

+23
-27
lines changed

10 files changed

+23
-27
lines changed

packages/devtools/client/components/Navbar.vue renamed to packages/devtools-ui-kit/src/components/NNavbar.vue

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
<script setup lang="ts">
2-
defineProps({
3-
search: {
4-
type: String,
5-
default: undefined,
6-
},
7-
noPadding: {
8-
type: Boolean,
9-
default: false,
10-
},
11-
})
2+
defineProps<{
3+
search?: string
4+
noPadding?: boolean
5+
}>()
126
137
const emit = defineEmits<{
148
(event: 'update:search', value: string): void
@@ -20,9 +14,9 @@ function update(event: any) {
2014
</script>
2115

2216
<template>
23-
<div flex="~ col gap2" border="b base" flex-1 navbar-glass :class="[{ p4: !noPadding }]">
17+
<div flex="~ col gap2" border="b base" flex-1 n-navbar-glass :class="[{ p4: !noPadding }]">
2418
<div flex="~ gap4" items-center>
25-
<slot name="search">
19+
<slot v-if="search !== undefined" name="search">
2620
<NTextInput
2721
placeholder="Search..."
2822
icon="carbon-search"

packages/devtools-ui-kit/src/unocss.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export function unocssPreset(): Preset {
154154
'n-loading': 'flex h-full w-full justify-center items-center',
155155
'n-panel-grids': 'n-panel-grids-light dark:n-panel-grids-dark',
156156
'n-panel-grids-center': 'n-panel-grids flex flex-col h-full gap-2 items-center justify-center',
157+
158+
// glass
159+
'n-glass-effect': 'backdrop-blur-6 bg-white/80 dark:bg-[#151515]/90',
160+
'n-navbar-glass': 'sticky z-10 top-0 n-glass-effect',
157161
},
158162
}
159163
}

packages/devtools/client/components/ComponentsGraph.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function setFilter() {
200200
</script>
201201

202202
<template>
203-
<Navbar ref="navbar" absolute left-0 right-0 top-0>
203+
<NNavbar ref="navbar" absolute left-0 right-0 top-0>
204204
<template #search>
205205
<div flex="~ gap-4 wrap" w-full>
206206
<NCheckbox v-model="showPages" n="primary sm">
@@ -225,7 +225,7 @@ function setFilter() {
225225
<div flex-auto />
226226
<slot />
227227
</template>
228-
</Navbar>
228+
</NNavbar>
229229

230230
<div relative h-full w-full>
231231
<div ref="container" h-full w-full />

packages/devtools/client/components/ComponentsList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const filtered = computed(() => {
8585
</script>
8686

8787
<template>
88-
<Navbar v-model:search="search" pb3>
88+
<NNavbar v-model:search="search" pb3>
8989
<template #actions>
9090
<slot />
9191
</template>
@@ -101,7 +101,7 @@ const filtered = computed(() => {
101101
]"
102102
/>
103103
</div>
104-
</Navbar>
104+
</NNavbar>
105105
<NSectionBlock
106106
v-if="filtered.user.length"
107107
icon="carbon-nominal"

packages/devtools/client/pages/modules/assets.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const navbar = ref<HTMLElement>()
7979

8080
<template>
8181
<div h-full of-auto>
82-
<Navbar ref="navbar" v-model:search="search" pb2>
82+
<NNavbar ref="navbar" v-model:search="search" pb2>
8383
<template #actions>
8484
<div flex-none flex="~ gap2 items-center">
8585
<NButton
@@ -95,7 +95,7 @@ const navbar = ref<HTMLElement>()
9595
<span v-if="search">{{ filtered.length }} matched · </span>
9696
<span>{{ assets?.length }} assets in total</span>
9797
</div>
98-
</Navbar>
98+
</NNavbar>
9999

100100
<AssetDropZone folder="/" />
101101

packages/devtools/client/pages/modules/imports.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const filtered = computed(() => {
7575

7676
<template>
7777
<div v-if="config" relative h-full of-auto>
78-
<Navbar v-model:search="search" pb3>
78+
<NNavbar v-model:search="search" pb3>
7979
<div v-if="importsMetadata" flex="~ gap-2 items-center">
8080
<NIcon icon="carbon-filter" op50 />
8181
<NSelectTabs
@@ -88,7 +88,7 @@ const filtered = computed(() => {
8888
]"
8989
/>
9090
</div>
91-
</Navbar>
91+
</NNavbar>
9292
<NSectionBlock
9393
v-if="filtered.user.size"
9494
:open="filtered.count.user <= DETAILS_MAX_ITEMS"

packages/devtools/client/pages/modules/open-graph.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ until(router).toBeTruthy().then((v) => {
9595
<template>
9696
<div flex="~" h-full w-full of-hidden>
9797
<div h-full flex-auto of-auto>
98-
<Navbar>
98+
<NNavbar>
9999
<template #search>
100100
<NTextInput
101101
v-model="routeInput"
@@ -135,7 +135,7 @@ until(router).toBeTruthy().then((v) => {
135135
/>
136136
</div>
137137
</template>
138-
</Navbar>
138+
</NNavbar>
139139
<div flex="~ col">
140140
<NSectionBlock
141141
text="Tags"

packages/devtools/client/pages/modules/server-routes.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function capitalize(str: string) {
133133
<template>
134134
<NSplitPane storage-key="tab-server-routes">
135135
<template #left>
136-
<Navbar v-model:search="search" pb2>
136+
<NNavbar v-model:search="search" pb2>
137137
<template #actions>
138138
<NButton
139139
v-tooltip="'Toggle View'"
@@ -156,7 +156,7 @@ function capitalize(str: string) {
156156
<span v-if="search" op50>{{ filtered.length }} matched · </span>
157157
<span op50>{{ serverRoutes?.length }} routes in total</span>
158158
</div>
159-
</Navbar>
159+
</NNavbar>
160160

161161
<ServerRouteListItem
162162
v-for="item in view === 'tree' ? filterByCollection : filtered"

packages/devtools/client/pages/modules/virtual-files.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const filteredFiles = computed(() => {
6363
<template>
6464
<NSplitPane class="virtual-files" storage-key="tab-virtual-files">
6565
<template #left>
66-
<Navbar
66+
<NNavbar
6767
v-model:search="searchString"
6868
no-padding p3
6969
/>

packages/devtools/client/uno.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ export default defineConfig({
88
'bg-base': 'n-bg-base',
99
'bg-active': 'n-bg-active',
1010
'border-base': 'n-border-base',
11-
'glass-effect': 'backdrop-blur-6 bg-white/80 dark:bg-[#151515]/90',
12-
'navbar-glass': 'sticky z-10 top-0 glass-effect',
1311

1412
'text-secondary': 'color-black/50 dark:color-white/50',
1513

0 commit comments

Comments
 (0)