fix(ui): align cross-platform chrome

This commit is contained in:
NimBold
2026-07-01 14:29:22 +03:30
parent 21fc115d98
commit fdca17910a
5 changed files with 128 additions and 59 deletions
+37 -20
View File
@@ -1,37 +1,54 @@
import { getCurrentWindow } from '@tauri-apps/api/window';
import { Minus, Square, X } from 'lucide-react';
import type { PointerEvent } from 'react';
const appWindow = getCurrentWindow();
const stopTitlebarDrag = (event: PointerEvent<HTMLButtonElement>) => {
event.stopPropagation();
};
export function WindowControls() {
return (
<div className="window-controls" aria-label="Window controls">
<button
type="button"
className="window-control"
title="Minimize"
aria-label="Minimize"
onClick={() => void appWindow.minimize()}
>
<Minus size={13} strokeWidth={2.25} />
</button>
<button
type="button"
className="window-control"
title="Maximize"
aria-label="Maximize"
onClick={() => void appWindow.toggleMaximize()}
>
<Square size={11} strokeWidth={2.25} />
</button>
<button
type="button"
className="window-control close"
title="Close"
aria-label="Close"
onClick={() => void appWindow.close()}
onPointerDown={stopTitlebarDrag}
onClick={(event) => {
event.stopPropagation();
void appWindow.close();
}}
>
<X size={14} strokeWidth={2.25} />
<X size={10} strokeWidth={3} />
</button>
<button
type="button"
className="window-control minimize"
title="Minimize"
aria-label="Minimize"
onPointerDown={stopTitlebarDrag}
onClick={(event) => {
event.stopPropagation();
void appWindow.minimize();
}}
>
<Minus size={10} strokeWidth={3} />
</button>
<button
type="button"
className="window-control maximize"
title="Maximize"
aria-label="Maximize"
onPointerDown={stopTitlebarDrag}
onClick={(event) => {
event.stopPropagation();
void appWindow.toggleMaximize();
}}
>
<Square size={8} strokeWidth={3} />
</button>
</div>
);