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 50 51 52 53 54 55 56 57 58 59 60 | 3x 16x 16x 16x 16x 16x 16x 8x 8x 8x 16x | import useNiceModal from "@common/Modal/ModalFactory/hooks/useNiceModal";
import NiceModal from "@ebay/nice-modal-react";
import GiveDraggableModal from "@shared/GiveDraggableModal/GiveDraggableModal";
import { useEffect, useState } from "react";
import { GiveNotificationTypes } from "./giveNotificationTypes";
import GiveNotificationProvider from "./provider/GiveNotificationProvider";
import LeftHeader from "./components/LeftHeader";
import useOpenGiveNotification from "./hooks/useOpenGiveNotification";
import BodySelector from "./components/BodySelector";
import FooterSelector from "./components/FooterSelector";
import NotificationTabs from "./components/NotificationTabsHeader";
import { BOTTOM_OFFSET, MODAL_HEIGHT } from "./utils";
const GiveNotificationModal = NiceModal.create(
(props: GiveNotificationTypes) => {
return (
<GiveNotificationProvider props={props}>
<GiveNotificationModalWrapper />
</GiveNotificationProvider>
);
},
);
function GiveNotificationModalWrapper() {
const { open } = useNiceModal();
const { handleClose } = useOpenGiveNotification();
const calculateY = () => window.innerHeight - MODAL_HEIGHT - BOTTOM_OFFSET;
const [y, setY] = useState(calculateY);
useEffect(() => {
const handleResize = () => {
setY(calculateY());
};
window.addEventListener("resize", handleResize);
return () => window.removeEventListener("resize", handleResize);
}, []);
return (
<GiveDraggableModal
key={y}
handleClose={handleClose}
open={open}
LeftHeaderSection={LeftHeader}
StickySection={NotificationTabs}
Body={BodySelector}
isDraggable={false}
FooterComponent={FooterSelector}
height="657px"
y={y}
x={40}
closeOnClickOutside
/>
);
}
export default GiveNotificationModal;
|