Skip to content

Commit dbddd4b

Browse files
committed
Moved static styling components to use styled API
1 parent 1fdd5ac commit dbddd4b

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/ui/widgets/ActionButton/actionButton.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Font } from "../../../types/font";
2020
import { Border } from "../../../types/border";
2121
import { MacroContext } from "../../../types/macros";
2222
import { ExitFileContext, FileContext } from "../../../misc/fileContext";
23-
import { Button } from "@mui/material";
23+
import { styled, Button as MuiButton } from "@mui/material";
2424

2525
import { diamondTheme } from "../../../diamondTheme";
2626

@@ -39,6 +39,27 @@ export interface ActionButtonProps {
3939
transparent?: boolean;
4040
}
4141

42+
const Button = styled(MuiButton)({
43+
"&.MuiButton-root": {
44+
display: "block",
45+
alignItems: "center",
46+
justifyContent: "center",
47+
height: "100%",
48+
width: "100%",
49+
minWidth: 0,
50+
minHeight: 0,
51+
padding: 0,
52+
overflow: "hidden",
53+
whiteSpace: "nowrap",
54+
wordBreak: "break-word",
55+
textTransform: "none"
56+
},
57+
"&.Mui-disabled": {
58+
cursor: "not-allowed",
59+
pointerEvents: "all !important"
60+
}
61+
});
62+
4263
export const ActionButtonComponent = (
4364
props: ActionButtonProps
4465
): JSX.Element => {
@@ -64,24 +85,7 @@ export const ActionButtonComponent = (
6485
color: foregroundColor.toString(),
6586
backgroundColor: backgroundColor,
6687
border: border,
67-
"&.MuiButton-root": {
68-
display: "block",
69-
alignItems: "center",
70-
justifyContent: "center",
71-
height: "100%",
72-
width: "100%",
73-
minWidth: 0,
74-
minHeight: 0,
75-
padding: 0,
76-
overflow: "hidden",
77-
textOverflow: "ellipsis",
78-
fontFamily: font,
79-
textTransform: "none"
80-
},
81-
"&.Mui-disabled": {
82-
cursor: "not-allowed",
83-
pointerEvents: "all !important"
84-
}
88+
fontFamily: font
8589
}}
8690
onClick={props.onClick}
8791
>
@@ -98,9 +102,7 @@ export const ActionButtonComponent = (
98102
<span
99103
style={{
100104
display: "block",
101-
transform: `rotation(${rotationStep * -90}deg)`.toString(),
102-
whiteSpace: "nowrap",
103-
textOverflow: "ellipsis"
105+
transform: `rotation(${rotationStep * -90}deg)`.toString()
104106
}}
105107
>
106108
{props.text ?? ""}

0 commit comments

Comments
 (0)