Skip to content

Commit

Permalink
Merge pull request #3823 from ProjectMirador/mui5-menu-item-variant
Browse files Browse the repository at this point in the history
Create a MenuItem variant instead of using inline sx styles
  • Loading branch information
marlo-longley authored Nov 29, 2023
2 parents ea70a21 + de50dc1 commit ee69853
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/CanvasAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class CanvasAnnotations extends Component {
{annotations.map((annotation) => (
<MenuItem
component={listContainerComponent}
variant="multiline"
sx={{
'&:hover,&:focus': {
backgroundColor: 'action.hover',
Expand All @@ -80,7 +81,6 @@ export class CanvasAnnotations extends Component {
borderBottom: '0.5px solid',
borderBottomColor: 'divider',
cursor: 'pointer',
whiteSpace: 'normal',
}}
key={annotation.id}
annotationid={annotation.id}
Expand Down
4 changes: 2 additions & 2 deletions src/components/CollectionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class CollectionDialog extends Component {
<MenuItem
key={c.id}
onClick={() => { this.selectCollection(c); }}
sx={{ whiteSpace: 'normal' }}
variant="multiline"
>
{CollectionDialog.getUseableLabel(c)}
</MenuItem>
Expand All @@ -271,7 +271,7 @@ export class CollectionDialog extends Component {
<MenuItem
key={m.id}
onClick={() => { this.selectManifest(m); }}
sx={{ whiteSpace: 'normal' }}
variant="multiline"
>
{CollectionDialog.getUseableLabel(m)}
</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion src/components/WindowSideBarCollectionPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function Item({
alignItems="flex-start"
button
component="li"
variant="multiline"
sx={{
borderBottom: '0.5px solid',
borderBottomColor: 'divider',
paddingRight: 1,
whiteSpace: 'normal',
}}
{...otherProps}
>
Expand Down
8 changes: 8 additions & 0 deletions src/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ export default {
useNextVariants: true // set so that console deprecation warning is removed
},
components: {
MuiMenuItem: {
variants: [
{
props: { variant: 'multiline' },
style: { whiteSpace: 'normal' }
},
]
},
CompanionWindowSection: {
styleOverrides: {
root: {
Expand Down

0 comments on commit ee69853

Please sign in to comment.