Tina Tarighian
commited on
Commit
·
57cdd61
1
Parent(s):
929a0b8
mobile scroll
Browse files- components/MainContent.js +1 -1
- hooks/useDeviceAndCanvas.js +8 -1
- pages/index.js +3 -3
- styles/globals.css +16 -0
components/MainContent.js
CHANGED
@@ -45,7 +45,7 @@ const MainContent = ({
|
|
45 |
/>
|
46 |
)}
|
47 |
|
48 |
-
<div ref={containerRef} className=
|
49 |
{/* Camera Setup */}
|
50 |
<CameraSetup
|
51 |
videoRef={videoRef}
|
|
|
45 |
/>
|
46 |
)}
|
47 |
|
48 |
+
<div ref={containerRef} className={`relative w-full max-w-4xl canvas-container ${isMobile ? 'mt-0' : 'mt-4'}`}>
|
49 |
{/* Camera Setup */}
|
50 |
<CameraSetup
|
51 |
videoRef={videoRef}
|
hooks/useDeviceAndCanvas.js
CHANGED
@@ -45,7 +45,14 @@ const useDeviceAndCanvas = () => {
|
|
45 |
const containerWidth = document.querySelector('.canvas-container')?.clientWidth || window.innerWidth;
|
46 |
// Set maximum width for the canvas - increased for desktop
|
47 |
const maxWidth = Math.min(containerWidth, isMobile ? 640 : 960);
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
setCanvasWidth(maxWidth);
|
51 |
setCanvasHeight(height);
|
|
|
45 |
const containerWidth = document.querySelector('.canvas-container')?.clientWidth || window.innerWidth;
|
46 |
// Set maximum width for the canvas - increased for desktop
|
47 |
const maxWidth = Math.min(containerWidth, isMobile ? 640 : 960);
|
48 |
+
|
49 |
+
// Calculate height based on aspect ratio, but reduce height on mobile
|
50 |
+
let height = maxWidth / aspectRatio;
|
51 |
+
|
52 |
+
// For mobile, reduce the height by 25% to make it more compact
|
53 |
+
if (isMobile) {
|
54 |
+
height = height * 0.75;
|
55 |
+
}
|
56 |
|
57 |
setCanvasWidth(maxWidth);
|
58 |
setCanvasHeight(height);
|
pages/index.js
CHANGED
@@ -11,9 +11,9 @@ const inter = Inter({ subsets: ['latin'] });
|
|
11 |
|
12 |
const Header = () => {
|
13 |
return (
|
14 |
-
<div className="sticky top-0 left-0 right-0 w-full bg-white p-
|
15 |
<div className="w-full flex justify-between items-center text-base max-w-7xl mx-auto">
|
16 |
-
<div className="text-gray-500">
|
17 |
<span className="text-black font-bold text-lg mr-2">HandSpew</span>
|
18 |
Built with <a
|
19 |
href="https://ai.google.dev"
|
@@ -47,7 +47,7 @@ export default function Home() {
|
|
47 |
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap" />
|
48 |
</Head>
|
49 |
<Header />
|
50 |
-
<main className="flex flex-col items-center p-4 bg-white font-['Google_Sans',sans-serif] pt-
|
51 |
<HandDetector />
|
52 |
</main>
|
53 |
</>
|
|
|
11 |
|
12 |
const Header = () => {
|
13 |
return (
|
14 |
+
<div className="sticky top-0 left-0 right-0 w-full bg-white p-2 z-50 shadow-sm">
|
15 |
<div className="w-full flex justify-between items-center text-base max-w-7xl mx-auto">
|
16 |
+
<div className="text-gray-500 text-sm md:text-base">
|
17 |
<span className="text-black font-bold text-lg mr-2">HandSpew</span>
|
18 |
Built with <a
|
19 |
href="https://ai.google.dev"
|
|
|
47 |
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap" />
|
48 |
</Head>
|
49 |
<Header />
|
50 |
+
<main className="flex flex-col items-center p-2 md:p-4 bg-white font-['Google_Sans',sans-serif] pt-2 md:pt-4 overflow-y-auto">
|
51 |
<HandDetector />
|
52 |
</main>
|
53 |
</>
|
styles/globals.css
CHANGED
@@ -80,4 +80,20 @@ body {
|
|
80 |
font-size: 12px;
|
81 |
line-height: 1.3;
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
|
|
80 |
font-size: 12px;
|
81 |
line-height: 1.3;
|
82 |
}
|
83 |
+
|
84 |
+
/* Compact layout for mobile */
|
85 |
+
.canvas-container {
|
86 |
+
margin-top: 0;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* Reduce spacing around elements on mobile */
|
90 |
+
.w-full {
|
91 |
+
margin-bottom: 0.5rem;
|
92 |
+
}
|
93 |
+
|
94 |
+
/* Make header more compact on mobile */
|
95 |
+
.sticky {
|
96 |
+
padding-top: 0.5rem;
|
97 |
+
padding-bottom: 0.5rem;
|
98 |
+
}
|
99 |
}
|