Skip to content

Commit 470f6ca

Browse files
committed
fix: make build pass
1 parent c1ae1f9 commit 470f6ca

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/app/page.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ export default function Home() {
7777
};
7878
}, []);
7979

80+
function getWindowWidth(): number {
81+
if (typeof window !== "undefined") {
82+
return window.innerWidth;
83+
}
84+
return 0;
85+
}
86+
8087
return (
8188
<main>
8289
<BackgroundGradient />
@@ -241,8 +248,8 @@ export default function Home() {
241248
<div className="mt-28 flex w-screen flex-col gap-y-16">
242249
<motion.div
243250
ref={infoSection1Ref}
244-
initial={{ x: -window.innerWidth }}
245-
animate={{ x: hasBeenInView.infoSection1 ? 0 : -window.innerWidth }}
251+
initial={{ x: -getWindowWidth() }}
252+
animate={{ x: hasBeenInView.infoSection1 ? 0 : -getWindowWidth() }}
246253
transition={{ duration: 1, delay: 0.2 }}
247254
>
248255
<InfoSection
@@ -267,8 +274,8 @@ export default function Home() {
267274
</motion.div>
268275
<motion.div
269276
ref={infoSection2Ref}
270-
initial={{ x: window.innerWidth - 100 }}
271-
animate={{ x: hasBeenInView.infoSection2 ? 0 : window.innerWidth - 100 }}
277+
initial={{ x: getWindowWidth() - 100 }}
278+
animate={{ x: hasBeenInView.infoSection2 ? 0 : getWindowWidth() - 100 }}
272279
transition={{ duration: 1, delay: 0.2 }}
273280
>
274281
<InfoSection

0 commit comments

Comments
 (0)