All files / src/sections/Checkout/Payment PaymentTabs.tsx

0% Statements 0/6
0% Branches 0/4
0% Functions 0/4
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                                 
import React from "react";
import { Box, BoxProps, styled } from "@mui/material";
import { palette } from "@palette";
 
type PaymentTabsProps = {
  method: "Credit" | "Debit";
  setMethod: React.Dispatch<React.SetStateAction<"Credit" | "Debit">>;
};
 
const PaymentTabs = ({ method, setMethod }: PaymentTabsProps) => {
  return (
    <Box display="flex" sx={{ mt: 4, mb: 2 }}>
      <PaymentTab
        active={method === "Credit"}
        onClick={() => setMethod("Credit")}
      >
        Credit Card
      </PaymentTab>
      <PaymentTab
        active={method === "Debit"}
        onClick={() => setMethod("Debit")}
      >
        Debit Card
      </PaymentTab>
    </Box>
  );
};
 
const PaymentTab = styled(Box)<BoxProps & { active: boolean }>(
  ({ active }) => ({
    padding: "4px 26px",
    borderRadius: "100px",
    cursor: "pointer",
    fontSize: 14,
    ...(!active && {
      fontWeight: "400",
      background: "none",
      color: palette.neutral[400],
    }),
    ...(active && {
      fontWeight: "500",
      background: "#F8EFFF",
      color: palette.info.main,
    }),
  }),
);
 
export default PaymentTabs;