Skip to content

Commit 57ae781

Browse files
committed
Feat: LinksEmptyCase를 추가 하였습니다
1 parent 82fbead commit 57ae781

File tree

8 files changed

+75
-7
lines changed

8 files changed

+75
-7
lines changed

src/components/folder/Folder.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default function Folder() {
1818
return (
1919
<>
2020
<FavoriteButtonList handleFavoriteClick={handleFavoriteClick} />
21+
2122
<LinksList folderId={folderId} />
2223
</>
2324
);

src/components/folder/LinksList/LinkOverview/LinkOverview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from "classnames/bind";
22
import Link from "next/link";
33
import Image from "next/image";
4+
import { Skeleton } from "@nextui-org/skeleton";
45

56
import { Ic_Logo } from "@/public";
67
import { getElapsedTime, getFormattedDate, getValidUrl } from "@/src/utils";
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import classNames from "classnames/bind";
2+
import { Skeleton } from "@nextui-org/skeleton";
3+
4+
import styles from "./LinkOverview.module.scss";
5+
6+
const cn = classNames.bind(styles);
7+
8+
export default function LinkSkeleton() {
9+
return (
10+
<div className={cn("LinkOverview")}>
11+
<Skeleton
12+
className={cn("imgBox")}
13+
style={{ width: "340px", height: "200px" }}
14+
/>
15+
<div className={cn("caption")}>
16+
<Skeleton
17+
className={cn("updatedAt")}
18+
style={{ width: "100%", height: "20px" }}
19+
/>
20+
<Skeleton
21+
className={cn("description")}
22+
style={{ width: "100%", height: "48px" }}
23+
/>
24+
<Skeleton
25+
className={cn("createdAt")}
26+
style={{ width: "100%", height: "20px" }}
27+
/>
28+
</div>
29+
</div>
30+
);
31+
}

src/components/folder/LinksList/LinkOverview/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.LinksEmptyCase {
2+
display: flex;
3+
flex-direction: column;
4+
justify-content: center;
5+
align-content: center;
6+
padding-top: 40px;
7+
padding-bottom: 40px;
8+
height: 50vh;
9+
text-align: center;
10+
11+
.text {
12+
color: #000;
13+
font-size: 16px;
14+
font-weight: 400;
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import classNames from "classnames/bind";
2+
import styles from "./LinksEmptyCase.module.scss";
3+
4+
const cn = classNames.bind(styles);
5+
6+
export default function LinkEmptyCase() {
7+
return (
8+
<section className={cn("LinksEmptyCase")}>
9+
<p className={cn("text")}>저장된 링크가 없습니다</p>
10+
</section>
11+
);
12+
}

src/components/folder/LinksList/LinksList.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classNames from "classnames/bind";
22
import { useQuery } from "@tanstack/react-query";
33

4-
import { LinkOverview } from "./LinkOverview";
4+
import { LinkOverview, LinksEmptyCase } from ".";
55
import { getFolderIdLinksData } from "@/src/apis";
66
import type { TLink } from "@/src/types/type";
77

@@ -27,10 +27,16 @@ export default function LinksList({ folderId }: LinksListProps) {
2727
const LINKS = folderId ? folderIdLinksData : totalLinksData;
2828

2929
return (
30-
<section className={cn("linkList")}>
31-
{LINKS?.map((link) => (
32-
<LinkOverview link={link} key={link.id} />
33-
))}
34-
</section>
30+
<>
31+
{LINKS && LINKS.length > 0 ? (
32+
<section className={cn("linkList")}>
33+
{LINKS.map((link) => (
34+
<LinkOverview link={link} key={link.id} />
35+
))}
36+
</section>
37+
) : (
38+
<LinksEmptyCase />
39+
)}
40+
</>
3541
);
3642
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as LinkOverview } from "./LinkOverview/LinkOverview";
2+
export { default as LinksEmptyCase } from "./LinksEmptyCase/LinksEmptyCase";

0 commit comments

Comments
 (0)