@zmzai/theme 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zmzai/theme",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "zmzai 全品牌设计系统 — Radix UI + framer-motion + Tailwind v4 + MiSans",
Binary file
@@ -28,6 +28,7 @@ export * from "./stateful-button";
28
28
 
29
29
  // === Layout & Structure ===
30
30
  export * from "./floating-navbar";
31
+ export * from "./navbar";
31
32
  export * from "./aceternity-sidebar";
32
33
  export * from "./bento-grid";
33
34
  export * from "./expandable-card";
@@ -0,0 +1,76 @@
1
+ "use client";
2
+
3
+ import { type ReactNode } from "react";
4
+ import { cn } from "../../utils/cn";
5
+ import { Logo } from "../../brand/logo";
6
+ import { Wordmark } from "../../brand/wordmark";
7
+
8
+ /**
9
+ * navItemClass — 导航项统一样式(全域导航一致)。
10
+ *
11
+ * active 时深墨 pill 高亮(bg-ink text-white),其余 hover 浮现。
12
+ * 链接本身由调用方渲染(Next.js 用 next/link,保持 SPA 导航),
13
+ * 只要都套这个 className,任何站点的导航观感就完全一致。
14
+ */
15
+ export function navItemClass(active: boolean): string {
16
+ return cn(
17
+ "inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors",
18
+ active
19
+ ? "bg-ink text-white"
20
+ : "text-ink-2 hover:bg-surface-2 hover:text-ink"
21
+ );
22
+ }
23
+
24
+ export interface NavbarProps {
25
+ /** Wordmark 后缀,如 "agent" / "relay"(品牌区自动 Logo + Wordmark) */
26
+ sublabel?: string;
27
+ /** 品牌区自定义(默认 Logo + Wordmark);传了则忽略 sublabel */
28
+ brand?: ReactNode;
29
+ /** 中间导航区(建议用 next/link 包 navItemClass(active)) */
30
+ children?: ReactNode;
31
+ /** 右侧操作区(用户信息 / 退出 / 入口按钮等) */
32
+ actions?: ReactNode;
33
+ /** 品牌区右侧的附属徽章(如域名 a.zmzai.cloud) */
34
+ badge?: ReactNode;
35
+ className?: string;
36
+ }
37
+
38
+ /**
39
+ * Navbar — 全域统一顶栏。
40
+ *
41
+ * 左:品牌区(Logo + Wordmark);中:导航;右:操作区。
42
+ * 固定高度 3.5rem,paper 底色 + 模糊,底部细线。
43
+ * 各站(agent / relay / auth / hub)都消费这一个组件,保证导航一致。
44
+ *
45
+ * @example
46
+ * <Navbar sublabel="agent" badge={<span>a.zmzai.cloud</span>} actions={<LogoutButton />}>
47
+ * <Link href="/fw" className={navItemClass(pathname === "/fw")}>新任务</Link>
48
+ * <Link href="/audit" className={navItemClass(pathname === "/audit")}>运行审计</Link>
49
+ * </Navbar>
50
+ */
51
+ export function Navbar({ sublabel, brand, children, actions, badge, className }: NavbarProps) {
52
+ return (
53
+ <header
54
+ className={cn(
55
+ "sticky top-0 z-40 flex h-14 items-center justify-between gap-4 border-b border-line bg-paper/80 px-5 backdrop-blur-md",
56
+ className
57
+ )}
58
+ >
59
+ <div className="flex min-w-0 items-center gap-2.5">
60
+ {brand ?? (
61
+ <span className="inline-flex items-center gap-2">
62
+ <Logo size={22} />
63
+ <Wordmark size={16} sublabel={sublabel} />
64
+ </span>
65
+ )}
66
+ {badge}
67
+ </div>
68
+ {children ? (
69
+ <nav className="flex min-w-0 items-center gap-1 overflow-x-auto" aria-label="主导航">
70
+ {children}
71
+ </nav>
72
+ ) : null}
73
+ {actions ? <div className="flex shrink-0 items-center gap-2.5">{actions}</div> : null}
74
+ </header>
75
+ );
76
+ }
@@ -0,0 +1 @@
1
+ export * from "./Navbar";