Skip to content

Commit

Permalink
chore(react): remove button augmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
brionmario committed Jan 30, 2023
1 parent f89761e commit d56a65d
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions packages/react/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,12 @@ export interface ButtonProps extends MuiButtonProps {}

const COMPONENT_NAME: string = 'Button';

declare module '@mui/material/Button' {
interface ButtonPropsVariantOverrides {
/**
* Provides extra visual weight to identify the primary action from a set of buttons.
*/
primary: true;
/**
* Any actions that are less important.
*/
secondary: true;
}
}

const Button: FC<ButtonProps> & WithWrapperProps = (props: ButtonProps): ReactElement => {
const {className, ...rest} = props;

const classes: string = clsx('oxygen-button', className);

const getResolvedProps = (): Partial<ButtonProps> => {
let {color, variant} = {...rest};

if (variant === 'primary') {
color = 'primary';
variant = 'contained';
} else if (variant === 'secondary') {
color = 'secondary';
variant = 'contained';
}

return {
...rest,
color,
variant,
};
};

return <MuiButton className={classes} {...getResolvedProps()} />;
return <MuiButton className={classes} {...rest} />;
};

Button.displayName = composeComponentDisplayName(COMPONENT_NAME);
Expand Down

0 comments on commit d56a65d

Please sign in to comment.