File size: 1,202 Bytes
4633f70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// App header: wordmark, mock-mode badge, theme toggle. Sticky on desktop.
import { isMockActive } from '../../api/client';
import { Pill } from '../ui/Primitives';
import './header.css';

interface Props {
  theme: 'dark' | 'light';
  onToggleTheme: () => void;
  onHome: () => void;
}

export function Header({ theme, onToggleTheme, onHome }: Props) {
  return (
    <header className="appheader">
      <button className="appheader__brand" onClick={onHome} aria-label="Home">
        <span className="appheader__mark" aria-hidden>
          <span className="appheader__mark-dot" />
        </span>
        <span className="appheader__name">
          RL<span className="appheader__name-accent">·</span>Restore
        </span>
      </button>

      <div className="appheader__right">
        {isMockActive() && <Pill tone="warn">demo data</Pill>}
        <button
          className="appheader__theme"
          onClick={onToggleTheme}
          aria-label={`Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`}
          title={`Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`}
        >
          {theme === 'dark' ? '☀' : '☾'}
        </button>
      </div>
    </header>
  );
}