@@ -7,40 +7,60 @@ import {
77 Icon ,
88 IconButton ,
99 ModalDialog ,
10+ ModalCloseButton ,
1011 Spinner ,
12+ Stack ,
1113 Toast ,
14+ useToggle ,
1215} from '@openedx/paragon' ;
13- import { Close } from '@openedx/paragon/icons' ;
16+ import { Close , Fullscreen , FullscreenExit } from '@openedx/paragon/icons' ;
1417import { useIntl , FormattedMessage } from '@edx/frontend-platform/i18n' ;
1518
19+ import { parseErrorMsg } from '@src/library-authoring/add-content/AddContent' ;
20+ import libraryMessages from '@src/library-authoring/add-content/messages' ;
21+ import usePromptIfDirty from '@src/generic/promptIfDirty/usePromptIfDirty' ;
22+
1623import { EditorComponent } from '../../EditorComponent' ;
1724import TitleHeader from './components/TitleHeader' ;
1825import * as hooks from './hooks' ;
1926import messages from './messages' ;
20- import { parseErrorMsg } from '../../../library-authoring/add-content/AddContent' ;
21- import libraryMessages from '../../../library-authoring/add-content/messages' ;
2227
2328import './index.scss' ;
24- import usePromptIfDirty from '../../../generic/promptIfDirty/usePromptIfDirty' ;
2529import CancelConfirmModal from './components/CancelConfirmModal' ;
2630
2731interface WrapperProps {
2832 children : React . ReactNode ;
33+ fullscreen ?: boolean ;
2934}
3035
31- export const EditorModalWrapper : React . FC < WrapperProps & { onClose : ( ) => void } > = ( { children, onClose } ) => {
36+ export const EditorModalWrapper : React . FC < WrapperProps & { onClose : ( ) => void } > = (
37+ {
38+ children,
39+ onClose,
40+ fullscreen = false ,
41+ } ,
42+ ) => {
3243 const intl = useIntl ( ) ;
3344
3445 const title = intl . formatMessage ( messages . modalTitle ) ;
3546 return (
36- < ModalDialog isOpen size = "xl" isOverflowVisible = { false } onClose = { onClose } title = { title } > { children } </ ModalDialog >
47+ < ModalDialog
48+ isOpen
49+ onClose = { onClose }
50+ title = { title }
51+ size = { fullscreen ? 'fullscreen' : 'xl' }
52+ isOverflowVisible = { false }
53+ hasCloseButton = { false }
54+ >
55+ { children }
56+ </ ModalDialog >
3757 ) ;
3858} ;
3959
40- export const EditorModalBody : React . FC < WrapperProps > = ( { children } ) => < ModalDialog . Body className = "pb-0" > { children } </ ModalDialog . Body > ;
60+ export const EditorModalBody : React . FC < WrapperProps > = ( { children } ) => < ModalDialog . Body className = "pb-0" > { children } </ ModalDialog . Body > ;
4161
4262// eslint-disable-next-line react/jsx-no-useless-fragment
43- export const FooterWrapper : React . FC < WrapperProps > = ( { children } ) => < > { children } </ > ;
63+ export const FooterWrapper : React . FC < WrapperProps > = ( { children } ) => < > { children } </ > ;
4464
4565interface Props extends EditorComponent {
4666 children : React . ReactNode ;
@@ -63,6 +83,7 @@ const EditorContainer: React.FC<Props> = ({
6383 const [ saved , setSaved ] = React . useState ( false ) ;
6484 const isInitialized = hooks . isInitialized ( ) ;
6585 const { isCancelConfirmOpen, openCancelConfirmModal, closeCancelConfirmModal } = hooks . cancelConfirmModalToggle ( ) ;
86+ const [ isFullscreen , , , toggleFullscreen ] = useToggle ( false ) ;
6687 const handleCancel = hooks . handleCancel ( { onClose, returnFunction } ) ;
6788 const { createFailed, createFailedError } = hooks . createFailed ( ) ;
6889 const disableSave = ! isInitialized ;
@@ -97,8 +118,9 @@ const EditorContainer: React.FC<Props> = ({
97118 handleCancel ( ) ;
98119 }
99120 } ;
121+
100122 return (
101- < EditorModalWrapper onClose = { confirmCancelIfDirty } >
123+ < EditorModalWrapper onClose = { confirmCancelIfDirty } fullscreen = { isFullscreen } >
102124 { createFailed && (
103125 < Toast show onClose = { clearCreateFailed } >
104126 { parseErrorMsg (
@@ -127,15 +149,27 @@ const EditorContainer: React.FC<Props> = ({
127149 />
128150 < ModalDialog . Header className = "shadow-sm zindex-10" >
129151 < 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- />
152+ < ActionRow >
153+ < h2 className = "h3 col pl-0" >
154+ < TitleHeader isInitialized = { isInitialized } />
155+ </ h2 >
156+ < ActionRow . Spacer />
157+ < Stack direction = "horizontal" reversed >
158+ < IconButton
159+ src = { Close }
160+ iconAs = { Icon }
161+ onClick = { confirmCancelIfDirty }
162+ alt = { intl . formatMessage ( messages . exitButtonAlt ) }
163+ autoFocus
164+ />
165+ < IconButton
166+ src = { isFullscreen ? FullscreenExit : Fullscreen }
167+ iconAs = { Icon }
168+ alt = { intl . formatMessage ( messages . toggleFullscreenButtonLabel ) }
169+ onClick = { toggleFullscreen }
170+ />
171+ </ Stack >
172+ </ ActionRow >
139173 </ div >
140174 </ ModalDialog . Header >
141175 < EditorModalBody >
0 commit comments