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