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.

ShippingModal.jsx 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Modal } from '@mui/material';
  2. import { Box } from '@mui/system';
  3. import PropType from 'prop-types';
  4. import ContactForm from '../../forms/contact/ContactForm';
  5. import ShippingDetailsForm from '../../forms/shipping-details/ShippingDetailsForm';
  6. const ShippingModal = ({
  7. open,
  8. handleClose,
  9. handleChangeShipping,
  10. handleChangeContact,
  11. }) => {
  12. return (
  13. <Modal
  14. open={open.isOpen}
  15. onClose={handleClose}
  16. aria-labelledby="modal-modal-title"
  17. aria-describedby="modal-modal-description"
  18. >
  19. <Box
  20. sx={{
  21. width: { xs: '90%', md: '50%' },
  22. top: '50%',
  23. left: '50%',
  24. position: 'absolute',
  25. transform: 'translate(-50%, -50%)',
  26. }}
  27. >
  28. {open.type === 'Shipping' && (
  29. <ShippingDetailsForm submitHandler={handleChangeShipping} />
  30. )}
  31. {open.type === 'Contact' && (
  32. <ContactForm submitHandler={handleChangeContact} />
  33. )}
  34. </Box>
  35. </Modal>
  36. );
  37. };
  38. ShippingModal.propTypes = {
  39. open: PropType.object,
  40. handleClose: PropType.func,
  41. handleChangeShipping: PropType.func,
  42. handleChangeContact: PropType.func,
  43. };
  44. export default ShippingModal;