Skip to content

Commit 954e34b

Browse files
committed
feat(json-render-ui): hide SPA nav when a single view is registered
A lone JSON-render view renders on its own — the top bar (brand + view switcher) only appears once more than one view is registered.
1 parent 06e02b8 commit 954e34b

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

  • packages/json-render-ui/src/spa

packages/json-render-ui/src/spa/main.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,22 @@ async function main(): Promise<void> {
102102
const activeEntry = list.find(e => e.stateKey === active.value) ?? list[0]
103103
const spec = specs[activeEntry.stateKey]
104104

105+
// A single view renders on its own — no nav. The top bar (brand +
106+
// segmented view switcher) only appears once there's more than one.
107+
const multiple = list.length > 1
108+
105109
return h('div', { class: 'min-h-screen bg-base color-base font-sans' }, [
106-
// Top bar: brand + (when >1) the shared segmented view switcher.
107-
h('div', {
108-
class: 'flex items-center gap-3 border-b border-base px5 h-nav',
109-
}, [
110-
h('div', { class: 'flex items-center gap-2 font-medium' }, [
111-
h('div', { class: 'i-ph:layout-duotone color-primary text-lg' }),
112-
h('span', 'JSON Render'),
113-
]),
114-
list.length > 1 ? h('div', { class: 'ml-auto' }, [renderTabs(list)]) : null,
115-
]),
110+
multiple
111+
? h('div', {
112+
class: 'flex items-center gap-3 border-b border-base px5 h-nav',
113+
}, [
114+
h('div', { class: 'flex items-center gap-2 font-medium' }, [
115+
h('div', { class: 'i-ph:layout-duotone color-primary text-lg' }),
116+
h('span', 'JSON Render'),
117+
]),
118+
h('div', { class: 'ml-auto' }, [renderTabs(list)]),
119+
])
120+
: null,
116121
h('div', { class: 'p6' }, [
117122
h(JsonRenderView, {
118123
spec: spec ?? null,

0 commit comments

Comments
 (0)