import { Button, Typography } from '@mui/material';
import { Box } from '@mui/system';
import PropType from 'prop-types';

const ShippingData = ({ email, address, city, postcode, handleOpen }) => {
  return (
    <>
      <Box
        sx={{
          display: 'flex',
          justifyContent: 'space-between',
          backgroundColor: '#f2f2f2',
          alignItems: 'center',
          mt: 2,
          ml: 12,
          mb: 2,
          width: '90%',
          borderRadius: 2,
          p: 1,
        }}
      >
        <Typography sx={{ fontSize: 18, fontWeight: 600 }}>Contact</Typography>
        <Typography>{email}</Typography>
        <Button
          sx={{
            height: 35,

            width: 125,
            fontSize: 15,
            textTransform: 'none',
            backgroundColor: '#CBA213',
            color: 'white',
          }}
          onClick={() => {
            handleOpen('Contact');
          }}
        >
          Change
        </Button>
      </Box>
      <Box
        sx={{
          display: 'flex',
          justifyContent: 'space-between',
          backgroundColor: '#f2f2f2',
          alignItems: 'center',
          ml: 12,
          mb: 2,
          width: '90%',
          borderRadius: 2,
          p: 1,
        }}
      >
        <Typography sx={{ fontSize: 18, fontWeight: 600 }}>
          Shipping to
        </Typography>
        <Typography>
          {address} | {city} | {postcode}
        </Typography>
        <Button
          sx={{
            height: 35,
            width: 125,
            fontSize: 15,
            textTransform: 'none',
            backgroundColor: '#CBA213',
            color: 'white',
          }}
          onClick={() => {
            handleOpen('Shipping');
          }}
        >
          Change
        </Button>
      </Box>
    </>
  );
};

ShippingData.propTypes = {
  email: PropType.string,
  address: PropType.string,
  city: PropType.string,
  postcode: PropType.string,
  handleOpen: PropType.func,
};

export default ShippingData;
