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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user