feat: windows support
This commit is contained in:
parent
7a265704e8
commit
5c0034aabd
9 changed files with 242 additions and 31 deletions
|
@ -1,8 +1,10 @@
|
|||
import { isWindows } from "@tauri-apps/api/helpers/os-check";
|
||||
import Sidebar from "./components/sidebar";
|
||||
|
||||
import { cn } from "./lib/utils";
|
||||
|
||||
import { dragging } from "./store";
|
||||
import TitleBar from "./components/title-bar";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
|
@ -11,6 +13,8 @@ export default function App() {
|
|||
"cursor-col-resize": dragging.value.isDragging,
|
||||
})}
|
||||
>
|
||||
{isWindows() && <TitleBar />}
|
||||
|
||||
<div className="grid grid-cols-[max-content,1fr]">
|
||||
<Sidebar />
|
||||
</div>
|
||||
|
|
78
src/components/title-bar.tsx
Normal file
78
src/components/title-bar.tsx
Normal file
|
@ -0,0 +1,78 @@
|
|||
import { isWindows } from "@tauri-apps/api/helpers/os-check";
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
|
||||
export default function TitleBar() {
|
||||
return (
|
||||
<div
|
||||
data-tauri-drag-region
|
||||
className="flex h-8 w-full select-none border-b bg-primary"
|
||||
>
|
||||
{isWindows() && <Windows />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Windows() {
|
||||
return (
|
||||
<div className="ml-auto flex">
|
||||
<button
|
||||
className="flex w-12 items-center justify-center transition-colors hover:bg-tertiary"
|
||||
onClick={() => appWindow.minimize()}
|
||||
>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M20 12L4 12"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
className="flex w-12 items-center justify-center transition-colors hover:bg-tertiary"
|
||||
onClick={() => appWindow.toggleMaximize()}
|
||||
>
|
||||
<svg
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12Z"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
className="flex w-12 items-center justify-center transition-colors hover:bg-red-500"
|
||||
onClick={() => appWindow.close()}
|
||||
>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M19 5L5 19M5 5L19 19"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue