Skip to content

Commit

Permalink
Ensure proper stacking of controls on small screens
Browse files Browse the repository at this point in the history
  • Loading branch information
marlo-longley committed Jan 15, 2025
1 parent 0574394 commit f9f2fa1
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/plugins/MiradorImageTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ const Root = styled('div')(({ small, theme: { palette } }) => {
borderImageSource: small ? borderImageBottom : borderImageRight,
borderRadius: 25,
display: 'flex',
flexDirection: 'row',
flexDirection: small ? 'column' : 'row',
position: 'absolute',
right: 8,
top: 8,
zIndex: 999,
...(small && { flexDirection: 'column' }),
};
});

const ControlContainer = styled('div')(({ small }) => ({
display: 'flex',
border: 0,

Check failure on line 50 in src/plugins/MiradorImageTools.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Expected object keys to be in insensitive ascending order. 'border' should be before 'display'

Check failure on line 50 in src/plugins/MiradorImageTools.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Expected object keys to be in insensitive ascending order. 'border' should be before 'display'

Check failure on line 50 in src/plugins/MiradorImageTools.js

View workflow job for this annotation

GitHub Actions / build (22.x)

Expected object keys to be in insensitive ascending order. 'border' should be before 'display'
borderImageSlice: 1,
flexDirection: small ? 'column' : 'row',
}));

const MiradorImageTools = ({
enabled = true,
open = true,
Expand Down Expand Up @@ -85,7 +91,6 @@ const MiradorImageTools = ({
updateViewport(windowId, viewConfigReset);
};

// Wrap applyFilters in useCallback to prevent unnecessary re-renders
const applyFilters = useCallback(() => {
const { canvas } = viewer || {};
if (!canvas) return;
Expand Down Expand Up @@ -148,7 +153,7 @@ const MiradorImageTools = ({
{isSmallDisplay && toggleButton}
{open && (
<>
<div style={{ border: 0, borderImageSlice: 1, display: 'flex' }}>
<ControlContainer small={isSmallDisplay}>
<ImageRotation
label={t('rotateRight')}
onClick={() => toggleRotate(90)}
Expand All @@ -164,8 +169,8 @@ const MiradorImageTools = ({
label={t('flip')}
onClick={toggleFlip}
/>
</div>
<div style={{ border: 0, borderImageSlice: 1, display: 'flex' }}>
</ControlContainer>
<ControlContainer small={isSmallDisplay}>
<ImageTool
type="brightness"
label={t('brightness')}
Expand Down Expand Up @@ -221,15 +226,15 @@ const MiradorImageTools = ({
>
<InvertColorsIcon />
</ImageTool>
</div>
<div style={{ border: 0, borderImageSlice: 1, display: 'flex' }}>
</ControlContainer>
<ControlContainer small={isSmallDisplay}>
<MiradorMenuButton
aria-label={t('revert')}
onClick={handleReset}
>
<ReplaySharpIcon />
</MiradorMenuButton>
</div>
</ControlContainer>
</>
)}
{!isSmallDisplay && toggleButton}
Expand Down

0 comments on commit f9f2fa1

Please sign in to comment.