All files / src/components TopBar.tsx

0% Statements 0/34
0% Branches 0/1
0% Functions 0/1
0% Lines 0/34

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                           
import { ClipboardList } from 'lucide-react';
import { Button } from './ui';
 
interface TopBarProps {
  title: string;
  subtitle?: string;
  onOpenDetail?: () => void;
  showDetailButton?: boolean;
}
 
export function TopBar({
  title,
  subtitle,
  onOpenDetail,
  showDetailButton = true
}: TopBarProps) {
  return (
    <header className="h-14 bg-white dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700 flex items-center px-4 flex-shrink-0">
      {/* 左侧标题 */}
      <div className="flex items-center gap-2">
        <div className="w-8 h-8 bg-gradient-to-br from-emerald-400 to-teal-500 rounded-lg flex items-center justify-center text-white font-bold shadow-sm">
          <span className="text-sm">Z</span>
        </div>
        <div>
          <span className="font-bold text-lg text-gray-900 dark:text-gray-100">{title}</span>
          {subtitle && (
            <span className="ml-2 text-sm text-gray-500 dark:text-gray-400">{subtitle}</span>
          )}
        </div>
      </div>
 
      {/* 中间区域 */}
      <div className="flex-1" />
 
      {/* 右侧按钮 */}
      <div className="flex items-center gap-1">
        {/* 详情按钮 */}
        {showDetailButton && onOpenDetail && (
          <Button
            variant="ghost"
            size="sm"
            onClick={onOpenDetail}
            className="flex items-center gap-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100"
            title="显示详情面板"
          >
            <ClipboardList className="w-4 h-4" />
            <span className="text-sm">详情</span>
          </Button>
        )}
      </div>
    </header>
  );
}