2023-07-07 13:53:08 +00:00
|
|
|
import { Button, Typography, useMediaQuery, useTheme } from "@mui/material";
|
2022-11-22 14:43:59 +00:00
|
|
|
|
|
|
|
interface Props {
|
2023-07-07 13:53:08 +00:00
|
|
|
name: string;
|
|
|
|
image: string;
|
|
|
|
isSelected?: boolean;
|
|
|
|
onClick: () => void;
|
2022-11-22 14:43:59 +00:00
|
|
|
}
|
|
|
|
|
2023-07-07 13:53:08 +00:00
|
|
|
export default function PaymentMethodCard({ name, image, isSelected, onClick }: Props) {
|
|
|
|
const theme = useTheme();
|
|
|
|
const upSm = useMediaQuery(theme.breakpoints.up("sm"));
|
2022-11-22 14:43:59 +00:00
|
|
|
|
2023-07-07 13:53:08 +00:00
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
sx={{
|
|
|
|
width: upSm ? "237px" : "100%",
|
|
|
|
p: "20px",
|
|
|
|
pr: "10px",
|
|
|
|
display: "flex",
|
|
|
|
justifyContent: "start",
|
|
|
|
borderRadius: "8px",
|
|
|
|
backgroundColor: theme.palette.background.default,
|
2023-08-23 12:23:35 +00:00
|
|
|
border: isSelected ? `1px solid ${theme.palette.purple.dark}` : `1px solid ${theme.palette.gray.main}`,
|
2023-07-07 13:53:08 +00:00
|
|
|
gap: "20px",
|
|
|
|
alignItems: "center",
|
|
|
|
flexWrap: "wrap",
|
2023-08-23 12:23:35 +00:00
|
|
|
boxShadow: isSelected ? `0 0 0 1.5px ${theme.palette.purple.dark};` : "none",
|
2023-07-07 13:53:08 +00:00
|
|
|
"&:hover": {
|
2023-08-23 12:23:35 +00:00
|
|
|
backgroundColor: theme.palette.purple.dark,
|
|
|
|
border: `1px solid ${theme.palette.purple.dark}`,
|
2023-07-07 13:53:08 +00:00
|
|
|
"& > p": {
|
|
|
|
color: "white",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
onClick={onClick}
|
|
|
|
>
|
|
|
|
<img src={image} alt="payment method" />
|
2023-08-22 10:28:22 +00:00
|
|
|
<Typography sx={{ color: theme.palette.gray.dark }}>{name}</Typography>
|
2023-07-07 13:53:08 +00:00
|
|
|
</Button>
|
|
|
|
);
|
2023-06-01 13:42:38 +00:00
|
|
|
}
|