mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 11:13:46 +08:00
parent
d16fc2b68b
commit
f665762cc8
@ -3,12 +3,19 @@ import { appWindow } from "@tauri-apps/api/window";
|
|||||||
import {
|
import {
|
||||||
CloseRounded,
|
CloseRounded,
|
||||||
CropSquareRounded,
|
CropSquareRounded,
|
||||||
|
FilterNoneRounded,
|
||||||
HorizontalRuleRounded,
|
HorizontalRuleRounded,
|
||||||
} from "@mui/icons-material";
|
} from "@mui/icons-material";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export const LayoutControl = () => {
|
export const LayoutControl = () => {
|
||||||
const minWidth = 40;
|
const minWidth = 40;
|
||||||
|
|
||||||
|
const [isMaximized, setIsMaximized] = useState(false);
|
||||||
|
appWindow.isMaximized().then((isMaximized) => {
|
||||||
|
setIsMaximized(() => isMaximized);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
@ -22,9 +29,21 @@ export const LayoutControl = () => {
|
|||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}
|
sx={{ minWidth, svg: { transform: "scale(0.9)" } }}
|
||||||
onClick={() => appWindow.toggleMaximize()}
|
onClick={() => {
|
||||||
|
setIsMaximized((isMaximized) => !isMaximized);
|
||||||
|
appWindow.toggleMaximize();
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<CropSquareRounded fontSize="small" />
|
{isMaximized ? (
|
||||||
|
<FilterNoneRounded
|
||||||
|
fontSize="small"
|
||||||
|
style={{
|
||||||
|
transform: "rotate(180deg) scale(0.7)",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<CropSquareRounded fontSize="small" />
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user