refactor: decompose TopBar into composable shell with children slot

TopBar was a monolith that hardcoded server-specific controls (status
filters, time range, auto-refresh, search trigger). Extract these into
standalone SearchTrigger and AutoRefreshToggle components. TopBar now
accepts children for the center slot, letting consumers compose their
own controls. Fixes cameleer/cameleer-saas#53.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-10 17:00:57 +02:00
parent 4a6e6dea96
commit b443fc787e
5 changed files with 61 additions and 64 deletions

View File

@@ -5,6 +5,8 @@ import type { SidebarTreeNode } from '../../../design-system/layout/Sidebar/Side
import { StatusDot } from '../../../design-system/primitives/StatusDot/StatusDot'
import { Box, Settings, FileText, ChevronRight } from 'lucide-react'
import { TopBar } from '../../../design-system/layout/TopBar/TopBar'
import { SearchTrigger } from '../../../design-system/layout/TopBar/SearchTrigger'
import { AutoRefreshToggle } from '../../../design-system/layout/TopBar/AutoRefreshToggle'
// ── DemoCard helper ──────────────────────────────────────────────────────────
@@ -122,7 +124,7 @@ export function LayoutSection() {
<DemoCard
id="topbar"
title="TopBar"
description="Top navigation bar with breadcrumb, search trigger, status filters, time range, environment badge, and user avatar."
description="Composable top navigation bar. Consumers pass children for the center slot (search, filters, etc.). Shell provides breadcrumb, theme toggle, env badge, and user menu."
>
<div className={styles.topbarPreview}>
<TopBar
@@ -132,9 +134,11 @@ export function LayoutSection() {
{ label: 'order-ingest' },
]}
environment="production"
user={{ name: 'Hendrik' }}
/>
>
<SearchTrigger onClick={() => {}} />
<AutoRefreshToggle active={true} onChange={() => {}} />
</TopBar>
</div>
</DemoCard>
</section>