File tree Expand file tree Collapse file tree 7 files changed +22
-9
lines changed
components/MessageBoxModal Expand file tree Collapse file tree 7 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,16 @@ interface DialogProps {
13
13
children : ReactNode
14
14
showCloseButton : boolean
15
15
onClose : ( ) => void
16
+ // modal or non-modal behavior https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
17
+ isModal ?: boolean
16
18
}
17
19
18
20
export const Dialog : React . FC < DialogProps > = ( {
19
21
children,
20
22
className,
21
23
showCloseButton = false ,
22
- onClose
24
+ onClose,
25
+ isModal = true
23
26
} ) => {
24
27
const dialogRef = useRef < HTMLDialogElement | null > ( null )
25
28
const onCloseRef = useRef ( onClose )
@@ -32,10 +35,14 @@ export const Dialog: React.FC<DialogProps> = ({
32
35
onCloseRef . current ( )
33
36
}
34
37
dialog . addEventListener ( 'cancel' , cancel )
35
- dialog [ 'showModal' ] ( )
38
+ if ( isModal ) {
39
+ dialog . showModal ( )
40
+ } else {
41
+ dialog . show ( )
42
+ }
36
43
return ( ) => {
37
44
dialog . removeEventListener ( 'cancel' , cancel )
38
- dialog [ ' close' ] ( )
45
+ dialog . close ( )
39
46
}
40
47
}
41
48
return
@@ -63,7 +70,7 @@ export const Dialog: React.FC<DialogProps> = ({
63
70
< dialog
64
71
className = { `Dialog__element ${ className } ` }
65
72
ref = { dialogRef }
66
- onClick = { onDialogClick }
73
+ onClick = { isModal ? onDialogClick : undefined }
67
74
>
68
75
{ showCloseButton && (
69
76
< div className = "Dialog__Close" >
Original file line number Diff line number Diff line change 1
1
.Dialog__element {
2
- top : 0 ;
3
- z-index : 8 ;
2
+ top : 50% ;
3
+ left : 50% ;
4
+ transform : translate (-50% , -50% );
5
+ z-index : 1000 ;
4
6
display : flex;
5
7
flex-direction : column;
6
8
padding : calc (var (--space-xl ) * 1.67 );
10
12
background : var (--color-neutral-800 );
11
13
color : var (--text-default );
12
14
opacity : 0 ;
13
- transform : translateY (50px );
14
15
transition : opacity 500ms , transform 500ms ;
15
16
max-width : min (700px , 85vw );
16
17
23
24
24
25
.Dialog__element [open ] {
25
26
opacity : 1 ;
26
- transform : translateY (0 );
27
27
box-shadow : 0px 0px 0px 100vmax var (--modal-backdrop );
28
28
}
29
29
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ interface MessageBoxModalProps {
20
20
showCheckbox ?: boolean
21
21
checkboxLabel ?: string
22
22
checkboxValue ?: boolean
23
+ isModal ?: boolean
23
24
}
24
25
25
26
const MessageBoxModal : React . FC < MessageBoxModalProps > = function ( props ) {
@@ -71,6 +72,7 @@ const MessageBoxModal: React.FC<MessageBoxModalProps> = function (props) {
71
72
onClose = { props . onClose }
72
73
showCloseButton
73
74
className = { classNames ( { errorDialog : props . type === 'ERROR' } ) }
75
+ isModal = { props . isModal }
74
76
>
75
77
< DialogHeader onClose = { props . onClose } > { props . title } </ DialogHeader >
76
78
< DialogContent className = "body dialogContent" >
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export default function DialogHandler() {
42
42
title = { dialogModalOptions . title ? dialogModalOptions . title : '' }
43
43
message = { dialogModalOptions . message ? dialogModalOptions . message : '' }
44
44
buttons = { dialogModalOptions . buttons ? dialogModalOptions . buttons : [ ] }
45
+ isModal = { dialogModalOptions . isModal }
45
46
onClose = { ( ) => handleClose ( ) }
46
47
/>
47
48
) }
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ const tooltipProps: Partial<TooltipProps> = {
18
18
position : 'right' ,
19
19
withArrow : true ,
20
20
className : 'Tooltip menu' ,
21
- arrowSize : 10
21
+ arrowSize : 10 ,
22
+ zIndex : 1001
22
23
}
23
24
24
25
export default observer ( function SidebarLinks ( ) {
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ const launch = async ({
164
164
return res ( )
165
165
}
166
166
showDialogModal ( {
167
+ isModal : false ,
167
168
message : t (
168
169
'gamepage:box.compability.message' ,
169
170
'This Windows game will run using a compatibility layer. You might encounter some issues or the game might not work at all.'
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ export type DialogModalOptions = {
73
73
buttons ?: Array < ButtonOptions >
74
74
type ?: DialogType
75
75
onClose ?: ( ) => void
76
+ isModal ?: boolean
76
77
}
77
78
78
79
export interface ExternalLinkDialogOptions {
You can’t perform that action at this time.
0 commit comments