Skip to content

Commit c10e5ee

Browse files
committed
feat: mobile support
1 parent a9a3052 commit c10e5ee

File tree

9 files changed

+84
-54
lines changed

9 files changed

+84
-54
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"react-dom": "^18.3.1",
2424
"react-router-dom": "^7.1.1",
2525
"three": "^0.172.0",
26+
"usehooks-ts": "^3.1.0",
2627
"zustand": "^5.0.3"
2728
},
2829
"devDependencies": {

pnpm-lock.yaml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/about/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function AboutPage() {
2020
transition={{
2121
duration: 0.5,
2222
}}
23-
className="text-2xl font-semibold"
23+
className="text-xl font-semibold lg:text-2xl"
2424
>
2525
Hi there,
2626
</motion.p>
@@ -37,7 +37,7 @@ export default function AboutPage() {
3737
duration: 0.5,
3838
delay: 0.3,
3939
}}
40-
className="leading-8"
40+
className="text-sm leading-6 lg:text-base lg:leading-8"
4141
>
4242
I'm Vincent Qi, a CS student at Carnegie Mellon University,
4343
<br /> and Ex-Founding SWE at EduBeyond.

src/components/contact/card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export default function ContactCard({
3535
<img src={icon} className="p-10" />
3636
</div>
3737
<div className="flex flex-col justify-center p-4">
38-
<h1 className="text-xl font-semibold">{name}</h1>
39-
<p className="font-light">{user}</p>
38+
<h1 className="text-lg font-semibold sm:text-xl">{name}</h1>
39+
<p className="text-sm font-light sm:text-base">{user}</p>
4040
</div>
4141
</motion.div>
4242
);

src/components/landing/namecard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { motion } from "motion/react";
2+
import { useMediaQuery } from "usehooks-ts";
23
import { fadeUp } from "../../animations/fade";
34

45
export default function Namecard() {
6+
const isMobile = useMediaQuery("(max-width: 1260px)");
57
const { initial, animate } = fadeUp(20);
68
return (
79
<motion.div
@@ -14,7 +16,9 @@ export default function Namecard() {
1416
delay: 0.5,
1517
}}
1618
>
17-
<h1 className="text-[350%] font-semibold">Vincent's Portfolio</h1>
19+
<h1 className="text-[350%] font-semibold">
20+
Vincent{isMobile ? " Qi" : "'s Portfolio"}
21+
</h1>
1822
</motion.div>
1923
);
2024
}

src/components/landing/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const NavbarButton = ({ text, page }: { text: string; page: Page }) => {
2323
style={{
2424
borderBottomColor: page === current ? "#FFFFFFFF" : "#00000000",
2525
}}
26-
className="cursor-pointer border-b-2 text-lg transition-all"
26+
className="cursor-pointer border-b-2 text-[90%] transition-all lg:text-lg"
2727
>
2828
{text}
2929
</motion.div>

src/components/landing/page.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { useEffect, useState } from "react";
33
import { useShallow } from "zustand/react/shallow";
44
import Scene from "../../scenes/scene";
55

6+
import { useMediaQuery } from "usehooks-ts";
67
import { PageStore, usePageStore } from "../../stores/page.store";
78
import Namecard from "./namecard";
89
import Navbar from "./navbar";
910
import { pages } from "./navpages";
1011

1112
export default function LandingPage() {
13+
const isMobile = useMediaQuery("(max-width: 840px)");
1214
const [showPages, setShowPages] = useState(false);
15+
const [showScene, setShowScene] = useState(false);
16+
1317
const { page } = usePageStore(
1418
useShallow((state: PageStore) => ({
1519
page: state.page,
@@ -20,14 +24,28 @@ export default function LandingPage() {
2024
setTimeout(() => {
2125
setShowPages(true);
2226
}, 1500);
27+
setTimeout(() => {
28+
setShowScene(true);
29+
}, 2000);
2330
});
2431

2532
return (
2633
<div className="flex h-screen w-screen flex-row font-poppins text-white">
27-
<div className="w-[50%]">
28-
<Scene />
29-
</div>
30-
<motion.div className="flex w-[50%] flex-col gap-4 py-20 pl-10 pr-20">
34+
{!isMobile && (
35+
<div
36+
style={{
37+
width: "50%",
38+
}}
39+
>
40+
{showScene && <Scene />}
41+
</div>
42+
)}
43+
<motion.div
44+
style={{
45+
width: isMobile ? "100%" : "50%",
46+
}}
47+
className="flex flex-col gap-4 py-20 pl-10 pr-20"
48+
>
3149
<div className="flex flex-col items-end justify-center">
3250
<Namecard />
3351
<Navbar />

src/components/projects/card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ export default function ProjectCard({
5757
<div className="flex w-full flex-row gap-4">
5858
<img src={image} alt={name} className="h-16 w-16 rounded-xl" />
5959
<div className="flex flex-col justify-center">
60-
<h1 className="text-lg font-semibold">{name}</h1>
61-
<p className="py-1 text-sm font-light">{description}</p>
60+
<h1 className="text-base font-semibold lg:text-lg">{name}</h1>
61+
<p className="py-1 text-xs font-light lg:text-sm">{description}</p>
6262
</div>
6363
</div>
6464
<div

src/scenes/scene.tsx

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,46 @@ import {
55
EffectComposer,
66
ToneMapping,
77
} from "@react-three/postprocessing";
8-
import { useEffect, useState } from "react";
98
import { useUnitSize } from "../hooks/useWindowSize";
109
import AboutScene from "./about/about";
1110

1211
function Scene() {
1312
// const { width, height } = useWindowSize();
1413
const unit = useUnitSize();
15-
const [show, setShow] = useState(false);
16-
useEffect(() => {
17-
setTimeout(() => {
18-
setShow(true);
19-
}, 2000);
20-
}, []);
2114
return (
2215
<div className="flex h-full w-full items-center justify-center p-4">
23-
{show && (
24-
<Canvas
25-
orthographic
26-
shadows
27-
camera={{
28-
position: [10, 10, 10],
29-
near: -2000,
30-
}}
31-
>
32-
{/* Scene effects */}
33-
<OrbitControls
34-
// enablePan={false}
35-
// enableZoom={false}
36-
maxPolarAngle={Math.PI / 2}
37-
maxAzimuthAngle={Math.PI / 2}
38-
minAzimuthAngle={0}
39-
/>
40-
<EffectComposer>
41-
<Bloom mipmapBlur luminanceThreshold={1} levels={1} intensity={1} />
42-
<ToneMapping />
43-
</EffectComposer>
16+
<Canvas
17+
orthographic
18+
shadows
19+
camera={{
20+
position: [10, 10, 10],
21+
near: -2000,
22+
}}
23+
>
24+
{/* Scene effects */}
25+
<OrbitControls
26+
// enablePan={false}
27+
// enableZoom={false}
28+
maxPolarAngle={Math.PI / 2}
29+
maxAzimuthAngle={Math.PI / 2}
30+
minAzimuthAngle={0}
31+
/>
32+
<EffectComposer>
33+
<Bloom mipmapBlur luminanceThreshold={1} levels={1} intensity={1} />
34+
<ToneMapping />
35+
</EffectComposer>
4436

45-
{/* Lighting */}
46-
<ambientLight intensity={0.6} />
47-
<directionalLight position={[100, 100, 0]} intensity={3} castShadow />
48-
<directionalLight position={[0, 100, 50]} intensity={2} />
37+
{/* Lighting */}
38+
<ambientLight intensity={0.6} />
39+
<directionalLight position={[100, 100, 0]} intensity={3} castShadow />
40+
<directionalLight position={[0, 100, 50]} intensity={2} />
4941

50-
{/* Scene switcher */}
51-
<directionalLight
52-
position={[-100, -100, 0]}
53-
intensity={Math.PI / 2}
54-
/>
55-
<mesh scale={[unit, unit, unit]} receiveShadow>
56-
<AboutScene />
57-
</mesh>
58-
</Canvas>
59-
)}
42+
{/* Scene switcher */}
43+
<directionalLight position={[-100, -100, 0]} intensity={Math.PI / 2} />
44+
<mesh scale={[unit, unit, unit]} receiveShadow>
45+
<AboutScene />
46+
</mesh>
47+
</Canvas>
6048
</div>
6149
);
6250
}

0 commit comments

Comments
 (0)