@@ -6,21 +6,24 @@ import {
6
6
FlexBoxWrap ,
7
7
Label ,
8
8
Link ,
9
- Popover
9
+ Popover ,
10
+ Text
10
11
} from '@ui5/webcomponents-react' ;
11
12
import ButtonDesign from '@ui5/webcomponents/dist/types/ButtonDesign.js' ;
12
13
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js' ;
13
14
import WrappingType from '@ui5/webcomponents/dist/types/WrappingType.js' ;
14
- import { useRef } from 'react' ;
15
+ import { useRef , useState } from 'react' ;
15
16
import { createPortal } from 'react-dom' ;
16
17
import BestRunLogo from '../../assets/SAP_Best_R_grad_blk_scrn.png' ;
17
18
import classes from './Footer.module.css' ;
18
19
19
20
export const Footer = ( { style } ) => {
20
21
const popoverRef = useRef ( null ) ;
21
22
const footerRef = useRef ( null ) ;
23
+ const [ privacyPopoverOpen , setPPOpen ] = useState ( false ) ;
22
24
const showPrivacyPopover = ( e ) => {
23
- popoverRef . current . showAt ( e . target ) ;
25
+ popoverRef . current . opener = e . target ;
26
+ setPPOpen ( ( prev ) => ! prev ) ;
24
27
} ;
25
28
26
29
return createPortal (
@@ -41,7 +44,11 @@ export const Footer = ({ style }) => {
41
44
</ Label >
42
45
</ FlexBox >
43
46
< FlexBox alignItems = { FlexBoxAlignItems . Center } wrap = { FlexBoxWrap . Wrap } >
44
- < Button design = { ButtonDesign . Transparent } onClick = { showPrivacyPopover } >
47
+ < Button
48
+ design = { ButtonDesign . Transparent }
49
+ onClick = { showPrivacyPopover }
50
+ accessibilityAttributes = { { hasPopup : 'dialog' , expanded : privacyPopoverOpen } }
51
+ >
45
52
Privacy
46
53
</ Button >
47
54
@@ -59,21 +66,27 @@ export const Footer = ({ style }) => {
59
66
</ FlexBox >
60
67
</ FlexBox >
61
68
</ div >
62
- { createPortal (
63
- < Popover
64
- headerText = { 'Privacy Statement' }
65
- ref = { popoverRef }
66
- placementType = { PopoverPlacement . Top }
67
- data-ui5-compact-size
68
- style = { { width : '360px' , maxWidth : '100%' } }
69
- >
70
- < Label wrappingType = { WrappingType . Normal } >
71
- This site is hosted by < Link > GitHub Pages</ Link > . Please see the < Link > GitHub Privacy Statement</ Link > for
72
- any information how GitHub processes your personal data.
73
- </ Label >
74
- </ Popover > ,
75
- document . body
76
- ) }
69
+ < Popover
70
+ open = { privacyPopoverOpen }
71
+ headerText = { 'Privacy Statement' }
72
+ ref = { popoverRef }
73
+ placement = { PopoverPlacement . Top }
74
+ data-ui5-compact-size
75
+ style = { { width : '360px' , maxWidth : '100%' } }
76
+ onClose = { ( ) => setPPOpen ( false ) }
77
+ >
78
+ < Text >
79
+ This site is hosted by{ ' ' }
80
+ < Link href = "https://pages.github.com/" target = "_blank" >
81
+ GitHub Pages
82
+ </ Link >
83
+ . Please see the{ ' ' }
84
+ < Link href = "https://docs.github.com/en/github/site-policy/github-privacy-statement" target = "_blank" >
85
+ GitHub Privacy Statement
86
+ </ Link > { ' ' }
87
+ for any information how GitHub processes your personal data.
88
+ </ Text >
89
+ </ Popover >
77
90
</ footer > ,
78
91
document . getElementById ( 'storybook-docs' )
79
92
) ;
0 commit comments