@@ -23,17 +23,18 @@ const StyledCloseButton = styled(MiradorMenuButton, { name: 'CompanionWindow', s
2323/**
2424 * CompanionWindow
2525 */
26- export function CompanionWindow ( props ) {
26+ export function CompanionWindow ( props ) { // eslint-disable-line react/require-default-props
27+ const {
28+ ariaLabel = undefined , classes = { } , direction, paperClassName = '' , onCloseClick = ( ) => { } , updateCompanionWindow = undefined , isDisplayed = false ,
29+ position = null , t = key => key , title = null , children = undefined , titleControls = null , size = { } ,
30+ defaultSidebarPanelWidth = 235 , defaultSidebarPanelHeight = 201 , innerRef = undefined ,
31+ } = props ;
32+
2733 /** */
28- const openInNewStyle = ( ) => {
29- const { direction } = props ;
30- if ( direction === 'rtl' ) return { transform : 'scale(-1, 1)' } ;
31- return { } ;
32- } ;
34+ const openInNewStyle = direction === 'rtl' ? { transform : 'scale(-1, 1)' } : { } ;
3335
3436 /** */
35- const resizeHandles = ( ) => {
36- const { direction, position } = props ;
37+ const resizeHandles = ( ( ) => {
3738 const positions = {
3839 ltr : {
3940 default : 'left' ,
@@ -69,12 +70,7 @@ export function CompanionWindow(props) {
6970 }
7071
7172 return base ;
72- } ;
73- const {
74- ariaLabel, classes, paperClassName, onCloseClick, updateCompanionWindow, isDisplayed,
75- position, t, title, children, titleControls, size,
76- defaultSidebarPanelWidth, defaultSidebarPanelHeight, innerRef,
77- } = props ;
73+ } ) ( ) ;
7874
7975 const isBottom = ( position === 'bottom' || position === 'far-bottom' ) ;
8076
@@ -111,7 +107,7 @@ export function CompanionWindow(props) {
111107 width : isBottom ? 'auto' : defaultSidebarPanelWidth ,
112108 } }
113109 disableDragging
114- enableResizing = { resizeHandles ( ) }
110+ enableResizing = { resizeHandles }
115111 minHeight = { 50 }
116112 minWidth = { position === 'left' ? 235 : 100 }
117113 >
@@ -130,7 +126,7 @@ export function CompanionWindow(props) {
130126 aria-label = { t ( 'openInCompanionWindow' ) }
131127 onClick = { ( ) => { updateCompanionWindow ( { position : 'right' } ) ; } }
132128 >
133- < OpenInNewIcon style = { openInNewStyle ( ) } />
129+ < OpenInNewIcon style = { openInNewStyle } />
134130 </ MiradorMenuButton >
135131 )
136132 : (
@@ -208,21 +204,3 @@ CompanionWindow.propTypes = {
208204 titleControls : PropTypes . node ,
209205 updateCompanionWindow : PropTypes . func ,
210206} ;
211-
212- CompanionWindow . defaultProps = {
213- ariaLabel : undefined ,
214- children : undefined ,
215- classes : { } ,
216- defaultSidebarPanelHeight : 201 ,
217- defaultSidebarPanelWidth : 235 ,
218- innerRef : undefined ,
219- isDisplayed : false ,
220- onCloseClick : ( ) => { } ,
221- paperClassName : '' ,
222- position : null ,
223- size : { } ,
224- t : key => key ,
225- title : null ,
226- titleControls : null ,
227- updateCompanionWindow : undefined ,
228- } ;
0 commit comments