AirShelf/components/Topbar.tsx
iye 086d92991e
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 7s
统一 Airshelf 界面组件与图标
2026-05-27 12:29:41 +08:00

66 lines
1.8 KiB
TypeScript

import Link from "next/link";
import Icon from "./Icon";
export interface Crumb {
label: string;
href?: string;
}
interface Props {
/** Pass crumbs to show breadcrumbs (e.g. inner pages). Omit to show the team switcher (workspace). */
crumbs?: Crumb[];
balance?: string;
}
export default function Topbar({ crumbs, balance = "¥327.40" }: Props) {
return (
<header className="topbar">
{crumbs && crumbs.length > 0 ? (
<nav className="crumbs">
{crumbs.map((c, i) => {
const last = i === crumbs.length - 1;
const sep = i > 0 ? <span key={`s-${i}`} className="sep">/</span> : null;
return last ? (
<span key={c.label}>{sep}<span className="here">{c.label}</span></span>
) : (
<span key={c.label}>
{sep}
{c.href ? <Link href={c.href}>{c.label}</Link> : <span>{c.label}</span>}
</span>
);
})}
</nav>
) : (
<div className="team-switcher" role="button">
<div className="p"></div>
<Icon name="chev-down" size={12} className="chev" />
</div>
)}
<div className="top-r">
<span className="balance-chip">
<Icon name="credit-card" size={13} />
<strong>{balance}</strong>
</span>
<button className="icon-btn" aria-label="通知">
<Icon name="bell" />
<span className="dot" />
</button>
<button className="pill-btn">
<Icon name="help" />
</button>
<button className="pill-btn">
<Icon name="doc" />
</button>
<button className="pill-btn upgrade">
<Icon name="up" />
</button>
</div>
</header>
);
}