@@ -8,39 +8,57 @@ import {
88 IconButton ,
99 ModalDialog ,
1010 Spinner ,
11+ Stack ,
1112 Toast ,
13+ useToggle ,
1214} from '@openedx/paragon' ;
13- import { Close } from '@openedx/paragon/icons' ;
15+ import { Close , CloseFullscreen , OpenInFull } from '@openedx/paragon/icons' ;
1416import { useIntl , FormattedMessage } from '@edx/frontend-platform/i18n' ;
1517
18+ import { parseErrorMsg } from '@src/library-authoring/add-content/AddContent' ;
19+ import libraryMessages from '@src/library-authoring/add-content/messages' ;
20+ import usePromptIfDirty from '@src/generic/promptIfDirty/usePromptIfDirty' ;
21+
1622import { EditorComponent } from '../../EditorComponent' ;
1723import TitleHeader from './components/TitleHeader' ;
1824import * as hooks from './hooks' ;
1925import messages from './messages' ;
20- import { parseErrorMsg } from '../../../library-authoring/add-content/AddContent' ;
21- import libraryMessages from '../../../library-authoring/add-content/messages' ;
2226
2327import './index.scss' ;
24- import usePromptIfDirty from '../../../generic/promptIfDirty/usePromptIfDirty' ;
2528import CancelConfirmModal from './components/CancelConfirmModal' ;
2629
2730interface WrapperProps {
2831 children : React . ReactNode ;
2932}
3033
31- export const EditorModalWrapper : React . FC < WrapperProps & { onClose : ( ) => void } > = ( { children, onClose } ) => {
34+ export const EditorModalWrapper : React . FC < WrapperProps & { onClose : ( ) => void , fullscreen ?: boolean } > = (
35+ {
36+ children,
37+ onClose,
38+ fullscreen = false ,
39+ } ,
40+ ) => {
3241 const intl = useIntl ( ) ;
3342
3443 const title = intl . formatMessage ( messages . modalTitle ) ;
3544 return (
36- < ModalDialog isOpen size = "xl" isOverflowVisible = { false } onClose = { onClose } title = { title } > { children } </ ModalDialog >
45+ < ModalDialog
46+ isOpen
47+ onClose = { onClose }
48+ title = { title }
49+ size = { fullscreen ? 'fullscreen' : 'xl' }
50+ isOverflowVisible = { false }
51+ hasCloseButton = { false }
52+ >
53+ { children }
54+ </ ModalDialog >
3755 ) ;
3856} ;
3957
40- export const EditorModalBody : React . FC < WrapperProps > = ( { children } ) => < ModalDialog . Body className = "pb-0" > { children } </ ModalDialog . Body > ;
58+ export const EditorModalBody : React . FC < WrapperProps > = ( { children } ) => < ModalDialog . Body className = "pb-0" > { children } </ ModalDialog . Body > ;
4159
4260// eslint-disable-next-line react/jsx-no-useless-fragment
43- export const FooterWrapper : React . FC < WrapperProps > = ( { children } ) => < > { children } </ > ;
61+ export const FooterWrapper : React . FC < WrapperProps > = ( { children } ) => < > { children } </ > ;
4462
4563interface Props extends EditorComponent {
4664 children : React . ReactNode ;
@@ -63,6 +81,7 @@ const EditorContainer: React.FC<Props> = ({
6381 const [ saved , setSaved ] = React . useState ( false ) ;
6482 const isInitialized = hooks . isInitialized ( ) ;
6583 const { isCancelConfirmOpen, openCancelConfirmModal, closeCancelConfirmModal } = hooks . cancelConfirmModalToggle ( ) ;
84+ const [ isFullscreen , , , toggleFullscreen ] = useToggle ( false ) ;
6685 const handleCancel = hooks . handleCancel ( { onClose, returnFunction } ) ;
6786 const { createFailed, createFailedError } = hooks . createFailed ( ) ;
6887 const disableSave = ! isInitialized ;
@@ -97,8 +116,9 @@ const EditorContainer: React.FC<Props> = ({
97116 handleCancel ( ) ;
98117 }
99118 } ;
119+
100120 return (
101- < EditorModalWrapper onClose = { confirmCancelIfDirty } >
121+ < EditorModalWrapper onClose = { confirmCancelIfDirty } fullscreen = { isFullscreen } >
102122 { createFailed && (
103123 < Toast show onClose = { clearCreateFailed } >
104124 { parseErrorMsg (
@@ -127,15 +147,27 @@ const EditorContainer: React.FC<Props> = ({
127147 />
128148 < ModalDialog . Header className = "shadow-sm zindex-10" >
129149 < div className = "d-flex flex-row justify-content-between" >
130- < h2 className = "h3 col pl-0" >
131- < TitleHeader isInitialized = { isInitialized } />
132- </ h2 >
133- < IconButton
134- src = { Close }
135- iconAs = { Icon }
136- onClick = { confirmCancelIfDirty }
137- alt = { intl . formatMessage ( messages . exitButtonAlt ) }
138- />
150+ < ActionRow >
151+ < h2 className = "h3 col pl-0" >
152+ < TitleHeader isInitialized = { isInitialized } />
153+ </ h2 >
154+ < ActionRow . Spacer />
155+ < Stack direction = "horizontal" reversed >
156+ < IconButton
157+ src = { Close }
158+ iconAs = { Icon }
159+ onClick = { confirmCancelIfDirty }
160+ alt = { intl . formatMessage ( messages . exitButtonAlt ) }
161+ autoFocus
162+ />
163+ < IconButton
164+ src = { isFullscreen ? CloseFullscreen : OpenInFull }
165+ iconAs = { Icon }
166+ alt = { intl . formatMessage ( messages . toggleFullscreenButtonLabel ) }
167+ onClick = { toggleFullscreen }
168+ />
169+ </ Stack >
170+ </ ActionRow >
139171 </ div >
140172 </ ModalDialog . Header >
141173 < EditorModalBody >
0 commit comments