feat: Add pin button

This commit is contained in:
MystiPanda 2024-01-09 15:13:42 +08:00
parent 96215e5950
commit 5ceac03db1

View File

@ -5,6 +5,8 @@ import {
CropSquareRounded,
FilterNoneRounded,
HorizontalRuleRounded,
PushPinOutlined,
PushPinRounded,
} from "@mui/icons-material";
import { useState } from "react";
@ -12,12 +14,28 @@ export const LayoutControl = () => {
const minWidth = 40;
const [isMaximized, setIsMaximized] = useState(false);
const [isPined, setIsPined] = useState(false);
appWindow.isMaximized().then((isMaximized) => {
setIsMaximized(() => isMaximized);
});
return (
<>
<Button
size="small"
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}
onClick={() => {
appWindow.setAlwaysOnTop(!isPined);
setIsPined((isPined) => !isPined);
}}
>
{isPined ? (
<PushPinRounded fontSize="small" />
) : (
<PushPinOutlined fontSize="small" />
)}
</Button>
<Button
size="small"
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}