Skip to content

Commit

Permalink
Fix height when switching to mobile design (#7165)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau authored Nov 14, 2024
1 parent 272766c commit 5419493
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions newIDE/app/src/UI/Responsive/ResponsiveWindowMeasurer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import useOnResize from '../../Utils/UseOnResize';
// Xlarge corresponds to large desktop screens.
export type WindowSizeType = 'small' | 'medium' | 'large' | 'xlarge';
const sizeThresholds = {
small: 600,
medium: 1150,
large: 1500,
smallHeight: 500,
smallWidth: 600,
mediumWidth: 1150,
largeWidth: 1500,
};

type Props = {|
Expand Down Expand Up @@ -53,22 +54,22 @@ export const useResponsiveWindowSize = (): {

const isLandscape = window.innerWidth > window.innerHeight;

return window.innerWidth < sizeThresholds.small ||
window.innerHeight < sizeThresholds.small // Mobile devices can be in landscape mode, so check both width and height.
return window.innerWidth < sizeThresholds.smallWidth ||
window.innerHeight < sizeThresholds.smallHeight // Mobile devices can be in landscape mode, so check both width and height.
? {
windowSize: 'small',
isMobile: true,
isMediumScreen: false,
isLandscape,
}
: window.innerWidth < sizeThresholds.medium
: window.innerWidth < sizeThresholds.mediumWidth
? {
windowSize: 'medium',
isMobile: false,
isMediumScreen: true,
isLandscape,
}
: window.innerWidth < sizeThresholds.large
: window.innerWidth < sizeThresholds.largeWidth
? {
windowSize: 'large',
isMobile: false,
Expand Down

0 comments on commit 5419493

Please sign in to comment.