aboutsummaryrefslogtreecommitdiff
path: root/desktop/src/components/Titlebar.tsx
blob: 70e43a9e2fafab51454ee4777737bc73fc2c6851 (plain)
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
55
56
import { getCurrentWindow } from "@tauri-apps/api/window";
import logoUrl from "../assets/logo.svg";

interface TitlebarProps {
  onToggleSidebar: () => void;
  isSidebarOpen: boolean;
}

export default function Titlebar({ onToggleSidebar, isSidebarOpen }: TitlebarProps) {
  const appWindow = getCurrentWindow();

  return (
    <div data-tauri-drag-region className="titlebar" id="titlebar">
      <div className="titlebar-left">
        <button
          className={`titlebar-btn toggle-sidebar ${isSidebarOpen ? "open" : ""}`}
          onClick={onToggleSidebar}
          aria-label={isSidebarOpen ? "Close sidebar" : "Open sidebar"}
          title="Toggle Tasks"
        >
          <svg className="menu-icon-svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round">
            <line className="line-top" x1="3" y1="6" x2="21" y2="6" />
            <line className="line-middle" x1="3" y1="12" x2="21" y2="12" />
            <line className="line-bottom" x1="3" y1="18" x2="21" y2="18" />
          </svg>
        </button>
      </div>
      <div data-tauri-drag-region className="titlebar-center">
        <img src={logoUrl} alt="Pomoru" className="titlebar-logo" />
      </div>
      <div className="titlebar-right">
        <button
          className="titlebar-btn minimize"
          onClick={() => appWindow.minimize()}
          aria-label="Minimize"
          title="Minimize"
        >
          <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round">
            <line x1="4" y1="12" x2="20" y2="12" />
          </svg>
        </button>
        <button
          className="titlebar-btn close"
          onClick={() => appWindow.close()}
          aria-label="Close"
          title="Close"
        >
          <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round">
            <line x1="18" y1="6" x2="6" y2="18" />
            <line x1="6" y1="6" x2="18" y2="18" />
          </svg>
        </button>
      </div>
    </div>
  );
}