mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
feat: Add pin button
This commit is contained in:
parent
96215e5950
commit
5ceac03db1
|
@ -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)" } }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user