-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make demo more responsive (#173)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2702df5
commit 87fe9fb
Showing
2 changed files
with
430 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
export function getSize() { | ||
const margin = window.innerWidth <= 768 ? 30 : 100; | ||
const BREAKPOINTS = { | ||
MOBILE: 480, | ||
TABLET: 768 | ||
}; | ||
|
||
const DENOMINATORS = { | ||
MOBILE: 2.5, // Larger height ratio for mobile | ||
TABLET: 3, // Medium height ratio for tablet | ||
DESKTOP: 4 // Smaller height ratio for desktop | ||
}; | ||
|
||
const denominator = | ||
window.innerWidth <= BREAKPOINTS.MOBILE ? DENOMINATORS.MOBILE : | ||
window.innerWidth <= BREAKPOINTS.TABLET ? DENOMINATORS.TABLET : | ||
DENOMINATORS.DESKTOP; | ||
return { | ||
width: Math.min(window.innerWidth - 100, 1100), | ||
height: window.innerHeight / 4, | ||
width: Math.min(window.innerWidth - margin, 1100), | ||
height: window.innerHeight / denominator, | ||
}; | ||
} |
Oops, something went wrong.