@@ -4,23 +4,24 @@ import SocialMediaContacts from "./SocialMediaContacts";
4
4
import { useRef , useState } from "react" ;
5
5
import LargePortraitCard from "./LargePortraitCard" ;
6
6
import Avatar from "./Avatar" ;
7
- import Link from "@docusaurus/Link" ;
8
7
9
8
const contentStyle = {
10
9
background : "white" ,
11
10
borderRadius : "10px" ,
11
+ opacity : 1.0
12
12
} ;
13
13
14
14
const overlayStyle = {
15
15
backgroundColor : "var(--ifm-background-color-popup-overlay)" ,
16
- opacity : " 0.4" ,
16
+ opacity : 0.4 ,
17
17
width : "100%" ,
18
18
height : "100%" ,
19
19
} ;
20
20
21
21
function getCenterOfViewport ( ) {
22
22
let horizontalCenter = Math . floor ( window . innerWidth / 2 ) ;
23
23
let verticalCenter = Math . floor ( window . innerHeight / 2 ) ;
24
+ console . log ( "Center of viewport:" , [ horizontalCenter , verticalCenter ] ) ;
24
25
return [ horizontalCenter , verticalCenter ] ;
25
26
}
26
27
@@ -35,6 +36,7 @@ function calculateOffsets(elementRef) {
35
36
xViewportCenter - xCardCenter ,
36
37
yViewportCenter - yCardCenter ,
37
38
] ;
39
+ console . log ( "Offsets are:" , offsets ) ;
38
40
return offsets ;
39
41
}
40
42
@@ -73,23 +75,21 @@ export function SmallPortraitCard({ person, setOffsets }) {
73
75
</ div >
74
76
) ;
75
77
}
76
- export default function PopupPortrait ( { person } ) {
78
+ export default function PopupPortrait ( { person, ... props } ) {
77
79
const [ offsets , setOffsets ] = useState ( [ 0 , 0 ] ) ;
78
- let [ isPopupOpen , setIsPopupOpen ] = useState ( false ) ;
79
-
80
+ let [ isPopupOpen , setIsPopupOpen ] = useState ( props . isPopupOpen ) ;
80
81
return (
81
82
< div >
83
+ < div >
84
+ < SmallPortraitCard person = { person } setOffsets = { setOffsets } />
85
+ </ div >
82
86
< Popup
83
87
open = { isPopupOpen }
84
88
closeOnEscape = { true }
85
89
closeOnDocumentClick = { true }
86
90
onClose = { ( ) => setIsPopupOpen ( false ) }
87
- trigger = {
88
- < div >
89
- < SmallPortraitCard person = { person } setOffsets = { setOffsets } />
90
- </ div >
91
- }
92
91
onOpen = { ( ) => {
92
+ props . isPopupOpen = true ;
93
93
setIsPopupOpen ( true ) ;
94
94
} }
95
95
contentStyle = { contentStyle }
0 commit comments