Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWC-7166 - Fix OrientationBanner display & add spreadSx utility #1463

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

nickgros
Copy link
Collaborator

  • Add utility to properly spread Sx props
  • Fix display of OrientationBanner
  • Use utility in components spreading sx

- Add utility to properly spread Sx props
- Fix `display` of OrientationBanner
- Use utility in components spreading sx
@@ -54,9 +56,10 @@ function OrientationBanner(props: OrientationBannerProps) {
localStorage.getItem(storageBannerId) === null,
)

const theme = useTheme()
const defaultSx = {
display: { xs: 'none', md: 'unset' },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this to unset ended up replacing the flex layout, so we had to remove unset somehow

Comment on lines +60 to +62
[theme.breakpoints.down('md')]: {
display: 'none',
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More concise/conventional way to just change the breakpoint styles is to do this. Now we aren't touching md and up.

...defaultSx,
...sx,
}}
sx={spreadSx(defaultSx, sx)}
Copy link
Collaborator Author

@nickgros nickgros Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned that you can pass an array of SxProps to sx and MUI will handle merging them. This is more versatile/accurate than spreading objects because it allows using the function form of SxProps. I created a new utility to facilitate creating this array.

@kianamcc kianamcc self-requested a review December 16, 2024 20:59
@nickgros nickgros merged commit 30ad953 into Sage-Bionetworks:main Dec 16, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants