File size: 1,296 Bytes
fecff63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"use client";

import React from "react";
import { RefreshCw } from "lucide-react";
import { Button } from "@micprotocol/ui";

export function AdminHeader({
  title,
  subtitle,
  onRefresh,
  refreshing,
  actions,
}: {
  title: string;
  subtitle?: string;
  onRefresh?: () => void;
  refreshing?: boolean;
  actions?: React.ReactNode;
}) {
  return (
    <header className="flex items-center justify-between gap-4 border-b border-[var(--border-color)] bg-[var(--bg-secondary)] px-6 py-4">
      <div className="min-w-0">
        <h1 className="font-display text-xl font-semibold text-[var(--text-primary)]">{title}</h1>
        {subtitle ? (
          <p className="mt-0.5 truncate text-sm text-[var(--text-secondary)]">{subtitle}</p>
        ) : null}
      </div>
      <div className="flex items-center gap-2">
        {actions}
        {onRefresh ? (
          <Button
            variant="ghost"
            size="sm"
            onClick={onRefresh}
            disabled={refreshing}
            title="Refresh data"
            className="text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)]"
          >
            <RefreshCw className={refreshing ? "animate-spin" : ""} />
          </Button>
        ) : null}
      </div>
    </header>
  );
}