1
1
import { createPortal } from "react-dom" ;
2
2
import Box from "@mui/material/Box" ;
3
- import Modal from "@mui/material/Modal" ;
4
- import Fade from "@mui/material/Fade" ;
5
3
import LeftPane from "./leftPane/LeftPane" ;
6
4
import RightPane from "./rightPane/RightPane" ;
7
- import CloseButton from "../common/closeButton/CloseButton" ;
8
5
import { styled } from "@mui/material/styles" ;
9
- import { useAppDispatch , useAppSelector } from "../../app/hooks" ;
10
- import { closePopup , popupIsOpen } from "./popupSlice" ;
11
- import mockItem from "../../data/mockItem" ;
6
+ import { useAppSelector } from "../../app/hooks" ;
7
+ import { selectPopupIsOpen , selectPopupData } from "./popupSlice" ;
12
8
import { POPUP_CONTAINER_ID } from "../map/mapLibre" ;
13
9
14
10
const StyledPopup = styled ( Box ) ( ( { theme } ) => ( {
15
- width : "calc (100% - (var(--spacing-large) * 2)) " ,
16
- height : "calc(100% - (var(--spacing-large) * 2 + 80px)) " ,
11
+ width : "300px " ,
12
+ height : "500px " ,
17
13
display : "flex" ,
18
14
backgroundColor : theme . palette . background . paper ,
19
15
padding : 0 ,
20
16
borderRadius : "var(--border-radius-xlarge)" ,
21
- margin : "auto var(--spacing-large)" ,
22
17
outline : "none" ,
23
18
position : "relative" ,
19
+ textAlign : "left" ,
20
+ overflowY : "auto" ,
24
21
"@media (min-width: 768px)" : {
25
22
width : "100%" ,
26
23
height : "auto" ,
27
- maxWidth : 900 ,
28
- maxHeight : 600 ,
24
+ minWidth : 600 ,
25
+ maxWidth : 700 ,
26
+ maxHeight : 450 ,
29
27
margin : "auto" ,
28
+ overflow : "hidden" ,
30
29
} ,
31
30
} ) ) ;
32
31
33
32
const StylePopupInner = styled ( Box ) ( ( ) => ( {
33
+ width : "100%" ,
34
34
display : "flex" ,
35
35
flexDirection : "column" ,
36
36
overflowY : "auto" ,
@@ -54,65 +54,20 @@ const StylePopupInner = styled(Box)(() => ({
54
54
} ,
55
55
} ) ) ;
56
56
57
- const StyledPointer = styled ( Box ) ( ( { theme } ) => ( {
58
- position : "absolute" ,
59
- bottom : - 17 ,
60
- left : "50%" ,
61
- transform : "translateX(-50%)" ,
62
- width : 0 ,
63
- borderLeft : "17px solid transparent" ,
64
- borderRight : "17px solid transparent" ,
65
- borderTop : `20px solid ${ theme . palette . background . paper } ` ,
66
- } ) ) ;
67
-
68
57
const Popup = ( ) => {
69
- const dispatch = useAppDispatch ( ) ;
70
- const open = useAppSelector ( popupIsOpen ) ;
71
-
72
- const handleClosePopup = ( ) => {
73
- dispatch ( closePopup ( ) ) ;
74
- } ;
58
+ const open = useAppSelector ( selectPopupIsOpen ) ;
59
+ const data = useAppSelector ( selectPopupData ) ;
75
60
76
61
return (
77
62
open &&
78
63
document . getElementById ( POPUP_CONTAINER_ID ) &&
79
64
createPortal (
80
- // <Modal
81
- // open={open}
82
- // onClose={handleClosePopup}
83
- // aria-labelledby={`pop-up-${mockItem.id}`}
84
- // aria-describedby="pop-up-description"
85
- // closeAfterTransition
86
- // >
87
- // <Fade in={open}>
88
- < StyledPopup id = "'aaaaaaaaaa" >
89
- { /* <CloseButton
90
- sx={{
91
- position: "absolute",
92
- right: "14px",
93
- top: "14px",
94
- }}
95
- buttonAction={handleClosePopup}
96
- /> */ }
65
+ < StyledPopup >
97
66
< StylePopupInner >
98
- < LeftPane
99
- name = { mockItem . name }
100
- primaryActivity = { mockItem . primary_activity }
101
- description = { mockItem . description }
102
- dcDomains = { mockItem . dc_domains }
103
- />
104
- < RightPane
105
- geocodedAddr = { mockItem . geocoded_addr }
106
- website = { mockItem . website }
107
- organisationalStructure = { mockItem . organisational_structure }
108
- typology = { mockItem . typology }
109
- dataSources = { mockItem . data_sources }
110
- />
67
+ < LeftPane { ...data } />
68
+ < RightPane { ...data } />
111
69
</ StylePopupInner >
112
- { /* <StyledPointer /> */ }
113
70
</ StyledPopup > ,
114
- // </Fade>
115
- // </Modal>
116
71
document . getElementById ( POPUP_CONTAINER_ID ) ! ! ,
117
72
)
118
73
) ;
0 commit comments