mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 05:13:44 +08:00
feat: Add pin button
This commit is contained in:
parent
bb193d3768
commit
abe18ac825
@ -5,6 +5,8 @@ import {
|
|||||||
CropSquareRounded,
|
CropSquareRounded,
|
||||||
FilterNoneRounded,
|
FilterNoneRounded,
|
||||||
HorizontalRuleRounded,
|
HorizontalRuleRounded,
|
||||||
|
PushPinOutlined,
|
||||||
|
PushPinRounded,
|
||||||
} from "@mui/icons-material";
|
} from "@mui/icons-material";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@ -12,12 +14,28 @@ export const LayoutControl = () => {
|
|||||||
const minWidth = 40;
|
const minWidth = 40;
|
||||||
|
|
||||||
const [isMaximized, setIsMaximized] = useState(false);
|
const [isMaximized, setIsMaximized] = useState(false);
|
||||||
|
const [isPined, setIsPined] = useState(false);
|
||||||
appWindow.isMaximized().then((isMaximized) => {
|
appWindow.isMaximized().then((isMaximized) => {
|
||||||
setIsMaximized(() => isMaximized);
|
setIsMaximized(() => isMaximized);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
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
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}
|
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user