You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
854 B
42 lines
854 B
import { |
|
Button as MUIButton, |
|
ButtonProps as MUIButtonProps, |
|
} from '@mui/material'; |
|
|
|
import { BLACK, GREY, TEXT } from '../lib/consts/DEFAULT_THEME'; |
|
|
|
type ContainedButtonProps = MUIButtonProps; |
|
|
|
const ContainedButton = ( |
|
containedButtonProps: ContainedButtonProps, |
|
): JSX.Element => { |
|
const { children, sx } = containedButtonProps; |
|
const combinedSx: ContainedButtonProps['sx'] = { |
|
backgroundColor: TEXT, |
|
color: BLACK, |
|
textTransform: 'none', |
|
|
|
'&:hover': { |
|
backgroundColor: GREY, |
|
}, |
|
|
|
...sx, |
|
}; |
|
|
|
return ( |
|
<MUIButton |
|
// eslint-disable-next-line react/jsx-props-no-spreading |
|
{...{ |
|
variant: 'contained', |
|
...containedButtonProps, |
|
sx: combinedSx, |
|
}} |
|
> |
|
{children} |
|
</MUIButton> |
|
); |
|
}; |
|
|
|
export type { ContainedButtonProps }; |
|
|
|
export default ContainedButton;
|
|
|