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.
41 lines
791 B
41 lines
791 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 |
|
{...{ |
|
variant: 'contained', |
|
...containedButtonProps, |
|
sx: combinedSx, |
|
}} |
|
> |
|
{children} |
|
</MUIButton> |
|
); |
|
}; |
|
|
|
export type { ContainedButtonProps }; |
|
|
|
export default ContainedButton;
|
|
|