Skip to content

Commit c16c1bd

Browse files
committed
design: 홈 페이지 퍼블리싱
1 parent 4b6181d commit c16c1bd

20 files changed

+611
-12
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
7+
"dev": "vite --host 0.0.0.0",
88
"build": "tsc -b && vite build",
99
"lint": "eslint .",
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"@emotion/react": "^11.14.0",
14+
"@emotion/styled": "^11.14.0",
1315
"@mui/icons-material": "^6.4.4",
16+
"@mui/material": "^6.4.4",
1417
"@tailwindcss/vite": "^4.0.6",
1518
"@tanstack/react-query": "^5.66.0",
1619
"axios": "^1.7.9",
20+
"gsap": "^3.12.7",
21+
"pnpm": "^10.4.1",
1722
"react": "^18.3.1",
1823
"react-dom": "^18.3.1",
1924
"react-router": "^7.1.5",
25+
"react-router-dom": "^7.1.5",
2026
"tailwind-merge": "^3.0.1",
2127
"tailwindcss": "^4.0.6",
2228
"zustand": "^5.0.3"

pnpm-lock.yaml

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

src/components/HomeButton.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import HomeOutlinedIcon from '@mui/icons-material/HomeOutlined';
2+
import { Link } from 'react-router';
3+
4+
export default function HomeButton() {
5+
return (
6+
<>
7+
<Link
8+
to="/"
9+
className="bg-primary-3 absolute right-5 bottom-[30px] z-50 flex h-13 w-13 items-center justify-center rounded-full text-white transition-all duration-200 hover:scale-105 active:scale-90"
10+
>
11+
<HomeOutlinedIcon />
12+
</Link>
13+
</>
14+
);
15+
}

src/components/ModalOverlay.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
interface ModalOverlayProps {
22
children: React.ReactElement;
3+
onClick?: () => void;
34
}
45

5-
const ModalOverlay = ({ children }: ModalOverlayProps) => {
6+
const ModalOverlay = ({ children, onClick }: ModalOverlayProps) => {
67
return (
7-
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60">
8+
<div
9+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
10+
onClick={onClick}
11+
>
812
{children}
913
</div>
1014
);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { useEffect, useRef } from 'react';
2+
import gsap from 'gsap';
3+
const FloatingLetters = () => {
4+
const lettersRef = useRef<HTMLImageElement[]>([]);
5+
useEffect(() => {
6+
if (!lettersRef.current) return;
7+
8+
lettersRef.current.forEach((letter, index) => {
9+
gsap.to(letter, {
10+
// x: Math.random() * 50 - 40,
11+
y: Math.random() * 20 - 25 + 'vh', // 위아래 이동
12+
rotation: Math.random() * 50 - 25, // 회전
13+
duration: Math.random() * 3 + 2, // 지속 시간
14+
repeat: -1, // 무한 반복
15+
yoyo: true, // 왕복
16+
ease: 'power1.inOut',
17+
delay: index * 1, // 편지마다 시차
18+
});
19+
});
20+
}, []);
21+
return (
22+
<>
23+
{Array.from({ length: 4 }).map((_, index) => (
24+
<img
25+
key={index}
26+
src={`/src/assets/letter_${index + 1}.png`}
27+
ref={(el) => {
28+
if (el) lettersRef.current[index] = el;
29+
}}
30+
className="absolute w-20 opacity-90"
31+
style={{
32+
left: `${index * 30 + 30}px`, // 편지지 간격
33+
top: '60vh',
34+
}}
35+
/>
36+
))}
37+
</>
38+
);
39+
};
40+
41+
export default FloatingLetters;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Link } from 'react-router';
2+
3+
const GoToLetterBoard = () => {
4+
return (
5+
<div className="absolute right-[-30px] bottom-48 z-20 flex w-fit">
6+
<div className="text-left">
7+
<p className="text-gray-60 body-r mb-1 ml-2">게시판</p>
8+
<Link to="/letter/board">
9+
<img
10+
src="/src/assets/go_to_letter_board.png"
11+
alt="go to letter board"
12+
className="w-[177px]"
13+
/>
14+
</Link>
15+
</div>
16+
</div>
17+
);
18+
};
19+
20+
export default GoToLetterBoard;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Link } from 'react-router';
2+
3+
const GoToLetterBox = () => {
4+
//TODO : hasNewLetters 전역으로 상태 관리하기
5+
let hasNewLetters = true;
6+
return (
7+
<div className="absolute bottom-10 left-5 z-30 flex w-fit">
8+
<div className="text-left">
9+
<p className="text-gray-60 body-r mb-1 ml-2">내 편지함</p>
10+
<Link to="/letter/box">
11+
<img
12+
src={
13+
hasNewLetters
14+
? 'src/assets/go_to_letter_box_new_letters.png'
15+
: '/src/assets/go_to_letter_box.png'
16+
}
17+
alt="go to letter box"
18+
className="w-[206.5px]"
19+
/>
20+
</Link>
21+
</div>
22+
</div>
23+
);
24+
};
25+
26+
export default GoToLetterBox;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Link } from 'react-router';
2+
3+
const GoToRandomLetter = () => {
4+
return (
5+
<>
6+
<p className="text-gray-60 body-r mb-1 rotate-[-5.277deg] pl-5">고민편지 보러가기</p>
7+
<Link to={'/letter/random'}>
8+
<img src="/src/assets/go_to_random_letter.png" alt="go to random letter" />
9+
</Link>
10+
</>
11+
);
12+
};
13+
14+
export default GoToRandomLetter;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Link } from 'react-router';
2+
3+
const GoToWrite = () => {
4+
return (
5+
<div className="h-fit pl-[87px]">
6+
<p className="text-gray-60 body-r mb-1 rotate-[-5.277deg]">속마음 나누기</p>
7+
<Link to={'/letter/write'}>
8+
<img src="/src/assets/go_to_write.png" alt="go to wrte" />
9+
</Link>
10+
</div>
11+
);
12+
};
13+
14+
export default GoToWrite;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import RandomCheer from './RandomCheer';
2+
import GoToWrite from './GoToWrite';
3+
import GoToRandomLetter from './GoToRandomLetter';
4+
5+
const HomeLeft = () => {
6+
return (
7+
<div className="flex w-full flex-shrink-0 grow snap-start flex-col justify-between pt-64">
8+
<RandomCheer />
9+
<GoToWrite />
10+
11+
<div className="relative mt-24 flex h-fit w-full flex-col justify-center">
12+
<div className="absolute top-[-94px] z-20 w-full">
13+
<GoToRandomLetter />
14+
</div>
15+
<img
16+
src="/src/assets/home_left_mountain.png"
17+
alt="home left mountain"
18+
className="z-10 w-full max-w-[600px]"
19+
/>
20+
</div>
21+
</div>
22+
);
23+
};
24+
25+
export default HomeLeft;

0 commit comments

Comments
 (0)