@@ -3,7 +3,8 @@ import React, { useRef, useState } from 'react';
3
3
import { Box , Dialog , IconButton , Paper , Typography } from '../../base' ;
4
4
import { ContainedButton , OutlinedButton , TextButton } from '../../base/Button/Button' ;
5
5
import { iconLarge , iconMedium } from '../../constants/iconsSizes' ;
6
- import { CloseIcon , InfoCircleIcon } from '../../icons' ;
6
+ import { CloseIcon , FullScreenIcon , InfoCircleIcon } from '../../icons' ;
7
+ import FullScreenExitIcon from '../../icons/Fullscreen/FullScreenExitIcon' ;
7
8
import { darkModalGradient , lightModalGradient } from '../../theme/colors/colors' ;
8
9
import { CustomTooltip } from '../CustomTooltip' ;
9
10
@@ -12,6 +13,7 @@ interface ModalProps extends DialogProps {
12
13
title : string ;
13
14
headerIcon ?: React . ReactNode ;
14
15
reactNode ?: React . ReactNode ;
16
+ isFullScreenModeAllowed ?: boolean ;
15
17
}
16
18
17
19
interface ModalFooterProps {
@@ -56,6 +58,20 @@ const StyledDialog = styled(Dialog)`
56
58
}
57
59
` ;
58
60
61
+ const FullscreenButton = styled ( FullScreenIcon ) ( ( { theme } ) => ( {
62
+ height : '2.25rem' ,
63
+ width : '2.25rem' ,
64
+ fill : theme . palette . common . white ,
65
+ cursor : 'pointer'
66
+ } ) ) ;
67
+
68
+ const FullscreenExitButton = styled ( FullScreenExitIcon ) ( ( { theme } ) => ( {
69
+ height : '2.25rem' ,
70
+ width : '2.25rem' ,
71
+ fill : theme . palette . common . white ,
72
+ cursor : 'pointer'
73
+ } ) ) ;
74
+
59
75
export const ModalStyledHeader = styled ( 'div' ) ( ( { theme } ) => ( {
60
76
background : theme . palette . mode === 'light' ? lightModalGradient . header : darkModalGradient . header ,
61
77
color : '#eee' ,
@@ -103,7 +119,8 @@ export const useModal = ({ headerIcon }: { headerIcon: React.ReactNode }): UseMo
103
119
export const ModalBody = styled ( Paper ) ( ( { theme } ) => ( {
104
120
padding : '1rem' ,
105
121
backgroundColor : theme . palette . background . surfaces ,
106
- overflowY : 'auto'
122
+ overflowY : 'auto' ,
123
+ height : '100%'
107
124
} ) ) ;
108
125
109
126
const StyledFooter = styled ( 'div' , {
@@ -135,16 +152,22 @@ export const Modal: React.FC<ModalProps> = ({
135
152
reactNode,
136
153
children,
137
154
maxWidth = 'xs' ,
155
+ isFullScreenModeAllowed,
138
156
...props
139
157
} ) => {
158
+ const [ fullScreen , setFullScreen ] = useState ( false ) ;
159
+ const toggleFullScreen = ( ) => {
160
+ setFullScreen ( ( prev ) => ! prev ) ;
161
+ } ;
140
162
return (
141
163
< StyledDialog
142
- fullWidth = { true }
143
164
maxWidth = { maxWidth }
144
165
open = { open }
145
166
onClose = { closeModal }
146
167
aria-labelledby = "alert-dialog-slide-title"
147
168
aria-describedby = "alert-dialog-slide-description"
169
+ fullScreen = { fullScreen }
170
+ fullWidth = { ! fullScreen }
148
171
{ ...props }
149
172
>
150
173
{ title && (
@@ -153,9 +176,20 @@ export const Modal: React.FC<ModalProps> = ({
153
176
< Typography component = { 'div' } variant = "h6" >
154
177
{ title }
155
178
</ Typography >
156
- < CloseBtn onClick = { closeModal } >
157
- < CloseIcon { ...iconLarge } fill = "#fff" > </ CloseIcon >
158
- </ CloseBtn >
179
+ < div style = { { display : 'flex' , alignItems : 'center' , gap : '1rem' } } >
180
+ { isFullScreenModeAllowed && (
181
+ < CustomTooltip title = { fullScreen ? 'Exit Fullscreen' : 'Enter Fullscreen' } >
182
+ { fullScreen ? (
183
+ < FullscreenExitButton onClick = { toggleFullScreen } />
184
+ ) : (
185
+ < FullscreenButton onClick = { toggleFullScreen } />
186
+ ) }
187
+ </ CustomTooltip >
188
+ ) }
189
+ < CloseBtn onClick = { closeModal } >
190
+ < CloseIcon { ...iconLarge } fill = "#fff" > </ CloseIcon >
191
+ </ CloseBtn >
192
+ </ div >
159
193
</ ModalStyledHeader >
160
194
) }
161
195
0 commit comments