front-hub/src/pages/Payment/PaymentMethodCard.tsx

44 lines
1.5 KiB
TypeScript
Raw Normal View History

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,
border: isSelected ? `1px solid ${theme.palette.purple.main}` : `1px solid ${theme.palette.gray.main}`,
2023-07-07 13:53:08 +00:00
gap: "20px",
alignItems: "center",
flexWrap: "wrap",
boxShadow: isSelected ? `0 0 0 1.5px ${theme.palette.purple.main};` : "none",
2023-07-07 13:53:08 +00:00
"&:hover": {
backgroundColor: theme.palette.purple.main,
border: `1px solid ${theme.palette.purple.main}`,
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>
);
}