|
1 | 1 | import React, { useEffect, useState } from "react"; |
2 | 2 | import { observer } from "mobx-react"; |
3 | 3 | // plane package imports |
4 | | -import { createPortal } from "react-dom"; |
| 4 | +import { ModalPortal, EPortalWidth, EPortalPosition } from "@plane/propel/portal"; |
5 | 5 | import { ICycle, IModule, IProject } from "@plane/types"; |
6 | | -import { cn } from "@plane/utils"; |
7 | 6 | import { useAnalytics } from "@/hooks/store/use-analytics"; |
8 | 7 | // plane web components |
9 | 8 | import { WorkItemsModalMainContent } from "./content"; |
@@ -32,41 +31,35 @@ export const WorkItemsModal: React.FC<Props> = observer((props) => { |
32 | 31 | updateIsEpic(isPeekView ? (isEpic ?? false) : false); |
33 | 32 | }, [isEpic, updateIsEpic, isPeekView]); |
34 | 33 |
|
35 | | - const portalContainer = document.getElementById("full-screen-portal") as HTMLElement; |
36 | | - |
37 | | - if (!isOpen) return null; |
38 | | - |
39 | | - const content = ( |
40 | | - <div className={cn("z-[25] h-full w-full overflow-y-auto absolute")}> |
| 34 | + return ( |
| 35 | + <ModalPortal |
| 36 | + isOpen={isOpen} |
| 37 | + onClose={handleClose} |
| 38 | + width={fullScreen ? EPortalWidth.FULL : EPortalWidth.THREE_QUARTER} |
| 39 | + position={EPortalPosition.RIGHT} |
| 40 | + fullScreen={fullScreen} |
| 41 | + > |
41 | 42 | <div |
42 | | - className={`top-0 right-0 z-[25] h-full bg-custom-background-100 shadow-custom-shadow-md absolute ${ |
43 | | - fullScreen ? "w-full p-2" : "w-1/2" |
| 43 | + className={`flex h-full flex-col overflow-hidden border-custom-border-200 bg-custom-background-100 text-left ${ |
| 44 | + fullScreen ? "rounded-lg border m-2" : "border-l" |
44 | 45 | }`} |
45 | 46 | > |
46 | | - <div |
47 | | - className={`flex h-full flex-col overflow-hidden border-custom-border-200 bg-custom-background-100 text-left ${ |
48 | | - fullScreen ? "rounded-lg border" : "border-l" |
49 | | - }`} |
50 | | - > |
51 | | - <WorkItemsModalHeader |
52 | | - fullScreen={fullScreen} |
53 | | - handleClose={handleClose} |
54 | | - setFullScreen={setFullScreen} |
55 | | - title={projectDetails?.name ?? ""} |
56 | | - cycle={cycleDetails} |
57 | | - module={moduleDetails} |
58 | | - /> |
59 | | - <WorkItemsModalMainContent |
60 | | - fullScreen={fullScreen} |
61 | | - projectDetails={projectDetails} |
62 | | - cycleDetails={cycleDetails} |
63 | | - moduleDetails={moduleDetails} |
64 | | - isEpic={isEpic} |
65 | | - /> |
66 | | - </div> |
| 47 | + <WorkItemsModalHeader |
| 48 | + fullScreen={fullScreen} |
| 49 | + handleClose={handleClose} |
| 50 | + setFullScreen={setFullScreen} |
| 51 | + title={projectDetails?.name ?? ""} |
| 52 | + cycle={cycleDetails} |
| 53 | + module={moduleDetails} |
| 54 | + /> |
| 55 | + <WorkItemsModalMainContent |
| 56 | + fullScreen={fullScreen} |
| 57 | + projectDetails={projectDetails} |
| 58 | + cycleDetails={cycleDetails} |
| 59 | + moduleDetails={moduleDetails} |
| 60 | + isEpic={isEpic} |
| 61 | + /> |
67 | 62 | </div> |
68 | | - </div> |
| 63 | + </ModalPortal> |
69 | 64 | ); |
70 | | - |
71 | | - return portalContainer ? createPortal(content, portalContainer) : content; |
72 | 65 | }); |
0 commit comments