Skip to content

Commit

Permalink
feat: make demo more responsive (#173)
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
sd2k and coderabbitai[bot] authored Nov 18, 2024
1 parent 2702df5 commit 87fe9fb
Show file tree
Hide file tree
Showing 2 changed files with 430 additions and 261 deletions.
20 changes: 18 additions & 2 deletions demo/helpers.js
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,
};
}
Loading

0 comments on commit 87fe9fb

Please sign in to comment.