Skip to content

Commit

Permalink
Merge pull request #63 from ProjectMirador/useTranslation
Browse files Browse the repository at this point in the history
Use mirador's useTranslation hook instead of expecting it to get pass…
  • Loading branch information
marlo-longley authored Feb 12, 2025
2 parents ef513a3 + e5fe989 commit 7527da5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion __tests__/MiradorImageTools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function createWrapper(props) {
windowId="x"
width="sm"
theme={mockPalette}
t={(k) => k}
{...props}
/>,
);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"peerDependencies": {
"@mui/material": "^5.x",
"mirador": "^4.0.0-alpha.6",
"mirador": "^4.0.0-alpha.10",
"react": "18.x",
"react-dom": "18.x"
},
Expand All @@ -51,7 +51,7 @@
"eslint-plugin-testing-library": "^6.2.0",
"glob": "^10.3.0",
"happy-dom": "^15.11.7",
"mirador": "^4.0.0-alpha.6",
"mirador": "^4.0.0-alpha.10",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"vite": "^6.0.0",
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/MiradorImageTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ReplaySharpIcon from '@mui/icons-material/ReplaySharp';
import { styled, alpha } from '@mui/material/styles';
import { useElementSize } from '@custom-react-hooks/use-element-size';
import mergeRefs from 'merge-refs';
import { MiradorMenuButton } from 'mirador';
import { MiradorMenuButton, useTranslation } from 'mirador';
import ImageTool from './ImageTool';
import ImageRotation from './ImageRotation';
import ImageFlip from './ImageFlip';
Expand Down Expand Up @@ -56,14 +56,14 @@ const MiradorImageTools = ({
enabled = true,
open = true,
innerRef = null,
t,
updateViewport,
updateWindow,
viewer = {},
viewConfig = {},
windowId,
}) => {
const [isSmallDisplay, setIsSmallDisplay] = useState(false);
const { t } = useTranslation();

const {
flip = false,
Expand Down Expand Up @@ -250,7 +250,6 @@ MiradorImageTools.propTypes = {
PropTypes.any,
]),
open: PropTypes.bool,
t: PropTypes.func.isRequired,
updateViewport: PropTypes.func.isRequired,
updateWindow: PropTypes.func.isRequired,
viewConfig: PropTypes.object, // eslint-disable-line react/forbid-prop-types
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/MiradorImageToolsMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import MenuItem from '@mui/material/MenuItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import TuneSharpIcon from '@mui/icons-material/TuneSharp';
import { useTranslation } from 'mirador';

const MiradorImageToolsMenuItem = ({
enabled = true,
handleClose,
t,
updateWindow,
windowId,
}) => {
const { t } = useTranslation();

const handleClickOpen = () => {
handleClose();
updateWindow(windowId, { imageToolsEnabled: !enabled });
Expand All @@ -32,7 +34,6 @@ const MiradorImageToolsMenuItem = ({
MiradorImageToolsMenuItem.propTypes = {
enabled: PropTypes.bool,
handleClose: PropTypes.func.isRequired,
t: PropTypes.func.isRequired,
updateWindow: PropTypes.func.isRequired,
windowId: PropTypes.string.isRequired,
};
Expand Down

0 comments on commit 7527da5

Please sign in to comment.