Skip to content

Commit 270b8ed

Browse files
authored
Merge pull request #60 from prgrms-fe-devcourse/style/UserList
[style/UserList] 유저 리스트 퍼블리싱
2 parents 147b922 + 329b7a9 commit 270b8ed

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

src/components/UserList.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { ChevronDown } from "lucide-react";
2+
import UserListCard from "./UserListCard";
3+
import { useState } from "react";
4+
5+
export default function UserList() {
6+
const [isOpen, setIsOpen] = useState(false);
7+
/* 필요한 정보 */
8+
/* 프로필 이미지, 이름, 소속, 학년(전공 과목), auth_id */
9+
return (
10+
<div className="absolute left-10 bottom-0 w-80 bg-white rounded-t-xl flex flex-col">
11+
{/* 헤더 */}
12+
<div
13+
className="cursor-pointer flex flex-row justify-between items-center px-5 py-3 w-full bg-violet-500 rounded-t-xl"
14+
onClick={() => setIsOpen(!isOpen)}
15+
>
16+
<h3 className="text-lg text-white font-bold">온라인 사용자</h3>
17+
<ChevronDown
18+
className={`text-white transition-transform duration-300 ${
19+
isOpen ? "rotate-0" : "rotate-180"
20+
}`}
21+
size={28}
22+
strokeWidth={3}
23+
/>
24+
</div>
25+
26+
{/* 슬라이딩 리스트 */}
27+
<div
28+
className={`pt-2 overflow-hidden transition-all duration-500 ease-in-out ${
29+
isOpen ? "max-h-160" : "max-h-0"
30+
}`}
31+
>
32+
<div className="flex flex-col">
33+
<UserListCard />
34+
<UserListCard />
35+
<UserListCard />
36+
<UserListCard />
37+
<UserListCard />
38+
<UserListCard />
39+
<UserListCard />
40+
<UserListCard />
41+
<UserListCard />
42+
<UserListCard />
43+
</div>
44+
</div>
45+
</div>
46+
);
47+
}

src/components/UserListCard.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Link } from "react-router";
2+
3+
export default function UserListCard() {
4+
return (
5+
<>
6+
<Link to={`/profile/해당 프로필 유저 Id`}>
7+
<div className="flex flex-row justify-between items-center py-4 px-5 hover:bg-[#F1F3F5]">
8+
{/* left */}
9+
<div className="flex flex-row items-center gap-2.5">
10+
{/* 이미지 */}
11+
<div className="relative w-12 h-12 bg-amber-300 rounded-lg">
12+
{/* 온라인 */}
13+
<div className="absolute right-0 bottom-0 w-4 h-4 bg-green-500 rounded-full border-2 border-white"></div>
14+
{/* 오프라인 */}
15+
{/* <div className="absolute right-0 bottom-0 w-4 h-4 bg-gray-400 rounded-full border-2 border-white"></div> */}
16+
</div>
17+
{/* 정보 */}
18+
<div className="flex flex-col gap-1 text-sm">
19+
{/* 이름 */}
20+
<div>홍길동</div>
21+
{/* 소속, 학년 (선생님은 전공) */}
22+
<div>학생, 3학년</div>
23+
</div>
24+
</div>
25+
{/* right */}
26+
<div className="space-x-2 text-xs">
27+
<button className="cursor-pointer px-2 py-1 bg-violet-500 text-white rounded hover:bg-violet-600">
28+
팔로우
29+
</button>
30+
<button className="cursor-pointer px-2 py-1 bg-gray-200 rounded hover:bg-gray-300">
31+
메시지
32+
</button>
33+
</div>
34+
</div>
35+
</Link>
36+
</>
37+
);
38+
}

src/layouts/MainLayout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Outlet } from "react-router";
22
import Header from "../components/layout/Header";
33
import Footer from "../components/layout/Footer";
4+
import UserList from "../components/UserList";
45

56
export default function MainLayout() {
67
return (
@@ -11,13 +12,15 @@ export default function MainLayout() {
1112
<Header />
1213

1314
{/* 스크롤 영역 */}
14-
<main className="overflow-y-auto bg-[#F3F4F6] flex flex-col items-center h-[calc(100vh-70px)]">
15+
<main className="relative overflow-y-auto bg-[#F3F4F6] flex flex-col items-center h-[calc(100vh-70px)]">
1516
<div className="min-h-[calc(100%)]">
1617
<div className="min-h-[calc(100%-90px)] pt-10">
1718
<Outlet />
1819
</div>
1920
<Footer />
2021
</div>
22+
{/* 유저 리스트 모달 */}
23+
<UserList />
2124
</main>
2225
</div>
2326
</>

0 commit comments

Comments
 (0)