This commit is contained in:
Manav Rathi 2024-05-25 07:10:47 +05:30
parent d51fb99fd3
commit b26b0759d6
No known key found for this signature in database
3 changed files with 7 additions and 14 deletions

View file

@ -1,10 +1,5 @@
import Done from "@mui/icons-material/Done"; import Done from "@mui/icons-material/Done";
import { import { Button, CircularProgress, type ButtonProps } from "@mui/material";
Button,
CircularProgress,
type ButtonProps,
type PaletteColor,
} from "@mui/material";
interface Iprops extends ButtonProps { interface Iprops extends ButtonProps {
loading?: boolean; loading?: boolean;
@ -26,11 +21,8 @@ export default function EnteButton({
...sx, ...sx,
...((loading || success) && { ...((loading || success) && {
"&.Mui-disabled": (theme) => ({ "&.Mui-disabled": (theme) => ({
backgroundColor: ( backgroundColor: theme.palette[props.color].main,
theme.palette[props.color] as PaletteColor color: theme.palette[props.color].contrastText,
).main,
color: (theme.palette[props.color] as PaletteColor)
.contrastText,
}), }),
}), }),
}} }}

View file

@ -1,11 +1,11 @@
import { FluidContainer } from "@ente/shared/components/Container"; import { FluidContainer } from "@ente/shared/components/Container";
import { Box, MenuItem, Typography } from "@mui/material"; import { Box, MenuItem, Typography, type ButtonProps } from "@mui/material";
import React, { useContext } from "react"; import React, { useContext } from "react";
import { OverflowMenuContext } from "./context"; import { OverflowMenuContext } from "./context";
interface Iprops { interface Iprops {
onClick: () => void; onClick: () => void;
color?: "primary" | "secondary" | "critical"; color?: ButtonProps["color"];
startIcon?: React.ReactNode; startIcon?: React.ReactNode;
endIcon?: React.ReactNode; endIcon?: React.ReactNode;
keepOpenAfterClick?: boolean; keepOpenAfterClick?: boolean;
@ -32,7 +32,7 @@ export function OverflowMenuOption({
onClick={handleClick} onClick={handleClick}
sx={{ sx={{
minWidth: 220, minWidth: 220,
color: (theme) => theme.palette[color]?.main, color: (theme) => theme.palette[color].main,
padding: 1.5, padding: 1.5,
"& .MuiSvgIcon-root": { "& .MuiSvgIcon-root": {
fontSize: "20px", fontSize: "20px",

View file

@ -70,6 +70,7 @@ declare module "@mui/material/Button" {
success: false; success: false;
info: false; info: false;
warning: false; warning: false;
inherit: false;
} }
} }
declare module "@mui/material/Checkbox" { declare module "@mui/material/Checkbox" {