Use native Windows title bar
All checks were successful
Build Windows App / build-windows (push) Successful in 22m0s
All checks were successful
Build Windows App / build-windows (push) Successful in 22m0s
This commit is contained in:
46
src/App.tsx
46
src/App.tsx
@@ -4,8 +4,6 @@ import {
|
||||
FileDown,
|
||||
FileInput,
|
||||
Languages,
|
||||
Maximize2,
|
||||
Minus,
|
||||
Plus,
|
||||
RefreshCcw,
|
||||
Settings,
|
||||
@@ -15,7 +13,7 @@ import {
|
||||
X
|
||||
} from "lucide-react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { PointerEvent, ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import packageInfo from "../package.json";
|
||||
import { transformEnv } from "./env";
|
||||
import type { EnvDefault } from "./env";
|
||||
@@ -328,50 +326,8 @@ export default function App() {
|
||||
setDefaults((current) => current.filter((_, entryIndex) => entryIndex !== index));
|
||||
}
|
||||
|
||||
function runWindowControl(event: PointerEvent<HTMLButtonElement>, action?: () => void) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
action?.();
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="appShell">
|
||||
<section className="titlebar">
|
||||
<div className="titlebarDrag">
|
||||
<div className="titlebarBrand">
|
||||
<div className="titlebarMark">EH</div>
|
||||
<span>EnvHelper</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="windowControls">
|
||||
<button
|
||||
aria-label="Minimize"
|
||||
onPointerDown={(event) => runWindowControl(event, window.envHelper?.minimizeWindow)}
|
||||
title="Minimize"
|
||||
type="button"
|
||||
>
|
||||
<Minus size={15} />
|
||||
</button>
|
||||
<button
|
||||
aria-label="Maximize"
|
||||
onPointerDown={(event) => runWindowControl(event, window.envHelper?.toggleMaximizeWindow)}
|
||||
title="Maximize"
|
||||
type="button"
|
||||
>
|
||||
<Maximize2 size={14} />
|
||||
</button>
|
||||
<button
|
||||
aria-label="Close"
|
||||
className="closeButton"
|
||||
onPointerDown={(event) => runWindowControl(event, window.envHelper?.closeWindow)}
|
||||
title="Close"
|
||||
type="button"
|
||||
>
|
||||
<X size={15} />
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<header className="toolbar">
|
||||
<div className="brand">
|
||||
<div className="brandMark">EH</div>
|
||||
|
||||
Reference in New Issue
Block a user