Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ShippingModal.tsx 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { Modal } from '@mui/material';
  2. import { Box } from '@mui/system';
  3. import ContactForm from '../../forms/contact/ContactForm';
  4. import ShippingDetailsForm, {
  5. FormValues,
  6. } from '../../forms/shipping-details/ShippingDetailsForm';
  7. import { FC } from 'react';
  8. import { ShippingData } from '../../../utils/interface/orderInterface';
  9. interface Props {
  10. open: { isOpen: boolean; type: string };
  11. handleClose: () => void;
  12. handleChangeShipping: (x: ShippingData | FormValues) => void;
  13. handleChangeContact: (values: string) => void;
  14. }
  15. const ShippingModal: FC<Props> = ({
  16. open,
  17. handleClose,
  18. handleChangeShipping,
  19. handleChangeContact,
  20. }) => {
  21. return (
  22. <Modal
  23. open={open.isOpen}
  24. onClose={handleClose}
  25. aria-labelledby="modal-modal-title"
  26. aria-describedby="modal-modal-description"
  27. >
  28. <Box
  29. sx={{
  30. width: { xs: '90%', md: '50%' },
  31. top: '50%',
  32. left: '50%',
  33. position: 'absolute',
  34. transform: 'translate(-50%, -50%)',
  35. }}
  36. >
  37. {open.type === 'Shipping' && (
  38. <ShippingDetailsForm
  39. submitHandler={handleChangeShipping}
  40. backBtn={false}
  41. isCheckout={false}
  42. enableBtn={true}
  43. />
  44. )}
  45. {open.type === 'Contact' && (
  46. <ContactForm submitHandler={handleChangeContact} />
  47. )}
  48. </Box>
  49. </Modal>
  50. );
  51. };
  52. export default ShippingModal;