refactor: organize desktop vs. mobile into separate folders
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Copy, Minus, Square, X } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function WindowControls() {
|
||||
const [isMaximized, setIsMaximized] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
return window.electronWindow.onMaximizeChange(setIsMaximized);
|
||||
}, []);
|
||||
|
||||
const minimize = (
|
||||
<Button
|
||||
key="minimize"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => window.electronWindow.minimize()}
|
||||
aria-label="Minimize"
|
||||
className="dark:hover:bg-white/10 rounded text-white/50"
|
||||
>
|
||||
<Minus />
|
||||
</Button>
|
||||
);
|
||||
|
||||
const maximize = (
|
||||
<Button
|
||||
key="maximize"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => window.electronWindow.maximize()}
|
||||
aria-label={isMaximized ? "Restore" : "Maximize"}
|
||||
className="dark:hover:bg-white/10 rounded text-white/50"
|
||||
>
|
||||
{isMaximized ? <Copy /> : <Square />}
|
||||
</Button>
|
||||
);
|
||||
|
||||
const close = (
|
||||
<Button
|
||||
key="close"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => window.electronWindow.close()}
|
||||
aria-label="Close"
|
||||
className="hover:text-destructive dark:hover:bg-white/10 rounded text-white/50"
|
||||
>
|
||||
<X />
|
||||
</Button>
|
||||
);
|
||||
|
||||
const buttons = [close, maximize, minimize];
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"no-drag flex items-center gap-0.5"
|
||||
)}
|
||||
>
|
||||
{buttons}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user