Skip to content

Commit

Permalink
Merge pull request #3956 from ProjectMirador/owner-state-destructure
Browse files Browse the repository at this point in the history
Simplify the parameters passed to the button
  • Loading branch information
marlo-longley authored Oct 29, 2024
2 parents 74283f5 + bd11b94 commit 6a0d2a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/MiradorMenuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Badge from '@mui/material/Badge';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';

const Root = styled(IconButton, { name: 'MiradorMenuButton', slot: 'root' })(({ ownerState, theme }) => ({
const Root = styled(IconButton, { name: 'MiradorMenuButton', slot: 'root' })(({ selected, theme }) => ({
fill: 'currentcolor',
...(ownerState.selected && {
...(selected && {
backgroundColor: theme.palette.action.selected,
}),
}));
Expand All @@ -23,6 +23,7 @@ export function MiradorMenuButton(props) {
children,
container,
dispatch,
selected,
BadgeProps,
TooltipProps,
sx,
Expand All @@ -31,7 +32,7 @@ export function MiradorMenuButton(props) {

const button = (
<Root
ownerState={props}
selected={selected}
{...iconButtonProps}
sx={sx}
size="large"
Expand Down

0 comments on commit 6a0d2a4

Please sign in to comment.