In the theme, allow for width and height to take part in a breakpoint definition
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Summary 💡
We can already define custom breakpoints, like:
const theme = createTheme({
breakpoints: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
values: {
mobile: 0,
tablet: 640,
laptop: 1024,
desktop: 1280,
},
},
});
that works ok when devices are in portrait. But what if people rotate their phones?
They would suddenly get the tablet-designs, since now width > 640 for most modern phones but we still might not want to show the tablet-designs on mobile phones.
I would love if we could define mobile as:
@media (max-width: 600px), (max-height: 600px) so phones in both landscape and portrait are under the mobile breakpoint.
Examples 🌈
With the <Grid> component for example we can do:
<Grid item xs={12} sm={3}>
now, I would like this grid to not change, when going from Portrait to Landscape on iPhones.
Motivation 🔦
Keeping designs consistent between landscape and portrait on mobile phones.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how createTheme handles breakpoints.values and how the Grid xs/sm example consumes those breakpoint definitions. Check the existing breakpoint behavior for portrait and landscape viewport dimensions, then define the width-and-height breakpoint behavior so the mobile layout remains unchanged when an iPhone rotates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100