diff --git a/src/components/CompanionArea.js b/src/components/CompanionArea.js index cac5b24e7..7d4061ce5 100644 --- a/src/components/CompanionArea.js +++ b/src/components/CompanionArea.js @@ -8,17 +8,29 @@ import CompanionWindowFactory from '../containers/CompanionWindowFactory'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import ns from '../config/css-ns'; -const StyledRoot = styled('div')(({ theme }) => ({ +const Root = styled('div', { name: 'CompanionArea', slot: 'root' })(({ position, theme }) => ({ display: 'flex', minHeight: 0, position: 'relative', zIndex: theme.zIndex.appBar - 2, + ...((position === 'bottom' || position === 'far-bottom') && { + flexDirection: 'column', + width: '100%', + }), })); -const StyledWrapper = styled('div')({ -}); +const Container = styled('div', { name: 'CompanionArea', slot: 'container' })(({ ownerState }) => ({ + display: ownerState?.companionAreaOpen ? 'flex' : 'none', + ...((ownerState?.position === 'bottom' || ownerState?.position === 'far-bottom') && { + flexDirection: 'column', + width: '100%', + }), + ...((ownerState?.position === 'left') && { + minWidth: '235px', + }), +})); -const StyledToggle = styled('div')(({ theme }) => ({ +const StyledToggle = styled('div', { name: 'CompanionArea', slot: 'toggle' })(({ theme }) => ({ alignItems: 'center', backgroundColor: theme.palette.background.paper, border: `1px solid ${theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.shades?.dark}`, @@ -28,18 +40,13 @@ const StyledToggle = styled('div')(({ theme }) => ({ height: '48px', left: '100%', marginTop: '1rem', + overflow: 'hidden', padding: 2, position: 'absolute', width: '23px', zIndex: theme.zIndex.drawer, })); -const StyledToggleButton = styled(MiradorMenuButton)({ - marginBottom: 1.5, - marginTop: 1.5, - padding: 0, -}); - /** */ export class CompanionArea extends Component { /** */ @@ -87,44 +94,31 @@ export class CompanionArea extends Component { } = this.props; const className = [this.areaLayoutClass(), ns(`companion-area-${position}`)].join(' '); return ( - + - 0}`} - style={{ display: companionAreaOpen ? 'flex' : 'none' }} - sx={{ - ...((position === 'bottom' || position === 'far-bottom') && { - flexDirection: 'column', - width: '100%', - }), - }} > {companionWindowIds.map((id) => ( ))} - + {setCompanionAreaOpen && position === 'left' && sideBarOpen && companionWindowIds.length > 0 && ( - { setCompanionAreaOpen(windowId, !companionAreaOpen); }} TooltipProps={{ placement: 'right' }} > {this.collapseIcon()} - + )} - + ); } }