From 04cf98a6915e482fb1bafa6280a6a2a89569764d Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 4 Dec 2023 08:39:32 -0800 Subject: [PATCH 1/2] Pull companion area styling up --- src/components/CompanionArea.js | 53 ++++++++++++++------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/src/components/CompanionArea.js b/src/components/CompanionArea.js index cac5b24e7..c70ef4799 100644 --- a/src/components/CompanionArea.js +++ b/src/components/CompanionArea.js @@ -8,17 +8,26 @@ 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%', + }), +})); -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 +37,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 +91,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()} - + )} - + ); } } From bb44477fc5ba97cd30c0c11972071890ec6b1b93 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 5 Dec 2023 15:34:39 -0800 Subject: [PATCH 2/2] Restore minWidth styling for left companion windows; fixes #3844 --- src/components/CompanionArea.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/CompanionArea.js b/src/components/CompanionArea.js index c70ef4799..7d4061ce5 100644 --- a/src/components/CompanionArea.js +++ b/src/components/CompanionArea.js @@ -25,6 +25,9 @@ const Container = styled('div', { name: 'CompanionArea', slot: 'container' })(({ flexDirection: 'column', width: '100%', }), + ...((ownerState?.position === 'left') && { + minWidth: '235px', + }), })); const StyledToggle = styled('div', { name: 'CompanionArea', slot: 'toggle' })(({ theme }) => ({