// ==============================|| OVERRIDES - BUTTON ||============================== //

export default function Button(theme) {
  const disabledStyle = {
    '&.Mui-disabled': {
      backgroundColor: theme.palette.grey[200]
    }
  };

  return {
    MuiButton: {
      defaultProps: {
        disableElevation: true,
        disableRipple: true
      },
      styleOverrides: {
        root: {
          fontWeight: 400,
          '&:active': {
            boxShadow: 'none',
            transform: 'none'
          }
        },
        contained: ({ theme: muiTheme, ownerState }) => ({
          ...disabledStyle,
          '&:active': {
            backgroundColor: muiTheme.palette[ownerState.color]?.main ?? muiTheme.palette.primary.main,
            boxShadow: 'none'
          }
        }),
        outlined: {
          ...disabledStyle,
          '&:active': {
            backgroundColor: 'transparent'
          }
        }
      }
    }
  };
}
