diff --git a/lib/toastMessage.ts b/lib/toastMessage.ts
index affd653..c877e0e 100644
--- a/lib/toastMessage.ts
+++ b/lib/toastMessage.ts
@@ -10,6 +10,7 @@ const toastMessages = {
editFolder: "폴더가 수정되었습니다",
copyLink: "링크가 복사되었습니다", // SNS 모달에서 링크 복사 시
SNSshare: "공유가 완료되었습니다",
+ addFolderInfo: "폴더를 생성해주세요",
},
error: {
login: "로그인 실패: 이메일 또는 비밀번호를 확인해주세요",
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 230fc4e..b8de4b5 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,5 +1,6 @@
import Footer from "@/components/Layout/Footer";
import Header from "@/components/Layout/Header";
+import { Modal } from "@/components/modal/modalManager/ModalManager";
import "@/styles/globals.css";
import type { AppProps } from "next/app";
import Head from "next/head";
@@ -20,7 +21,10 @@ export default function App({ Component, pageProps }: AppProps) {
property="og:description"
content="나만의 링크를 관리하는 Linkbrary"
/>
-
+
+
{!hidePaths.includes(router.pathname) &&
}
diff --git a/pages/_document.tsx b/pages/_document.tsx
index db50883..eeae17c 100644
--- a/pages/_document.tsx
+++ b/pages/_document.tsx
@@ -4,7 +4,7 @@ export default function Document() {
return (
-
+
diff --git a/pages/favorite/index.tsx b/pages/favorite/index.tsx
index b62fdf0..f475e58 100644
--- a/pages/favorite/index.tsx
+++ b/pages/favorite/index.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { useRouter } from "next/router";
import { GetServerSideProps, GetServerSidePropsContext } from "next";
import { parse } from "cookie";
@@ -10,6 +10,7 @@ import Pagination from "@/components/Pagination";
import useFetchLinks from "@/hooks/useFetchLinks";
import EmptyFavoriteList from "@/components/Favorite/EmptyFavoriteList";
import LinkCardSkeleton from "@/components/skeleton/LinkCardSkeleton";
+import useViewport from "@/hooks/useViewport";
interface FavoriteDataType {
id: number;
@@ -64,6 +65,12 @@ const FavoritePage = ({
useState
(favoriteList);
const [isLoading, setIsLoading] = useState(false);
const [totalCount, setTotalCount] = useState(initialTotalCount);
+ const { isMobile, isTablet, isPC, width } = useViewport();
+ const [cardCount, setCardCount] = useState(3);
+ useEffect(() => {
+ const newCount = isPC ? 3 : isTablet ? 2 : 1;
+ setCardCount(newCount);
+ }, [width]);
useFetchLinks(setLinkCardList, setIsLoading);
@@ -87,8 +94,8 @@ const FavoritePage = ({
- {[...Array(3)].map((_, index) => (
+
+ {[...Array(cardCount)].map((_, index) => (
))}
diff --git a/pages/link/index.tsx b/pages/link/index.tsx
index c330ef4..67b2d17 100644
--- a/pages/link/index.tsx
+++ b/pages/link/index.tsx
@@ -4,7 +4,6 @@ import { useRouter } from "next/router";
import { parse } from "cookie";
import { LinkData } from "@/types/linkTypes";
import { FolderData } from "@/types/folderTypes";
-import { Modal } from "@/components/modal/modalManager/ModalManager";
import { SearchInput } from "../../components/Search/SearchInput";
import { useLinkCardStore } from "@/store/useLinkCardStore";
import axiosInstance from "@/lib/api/axiosInstanceApi";
@@ -22,8 +21,9 @@ import RenderEmptyLinkMessage from "@/components/Link/RenderEmptyLinkMessage";
import useFetchLinks from "@/hooks/useFetchLinks";
import useViewport from "@/hooks/useViewport";
import useFolderName from "@/hooks/useFolderName";
-import LoadingSpinner from "@/components/LoadingSpinner";
import LinkCardSkeleton from "@/components/skeleton/LinkCardSkeleton";
+import toast, { Toaster } from "react-hot-toast";
+import toastMessages from "@/lib/toastMessage";
interface LinkPageProps {
linkList: LinkData[];
@@ -79,13 +79,18 @@ const LinkPage = ({
}: LinkPageProps) => {
const router = useRouter();
const { search, folder } = router.query;
- const { isOpen } = useModalStore();
- const { isMobile } = useViewport();
+ const { isMobile, isTablet, isPC, width } = useViewport();
const { totalCount, linkCardList, setLinkCardList } =
useLinkCardStore.getState();
const [isLoading, setIsLoading] = useState(false);
const [folderName] = useFolderName(folder);
const [folderList, setFolderList] = useState(initialFolderList);
+ const { openModal } = useModalStore();
+ const [cardCount, setCardCount] = useState(3);
+ useEffect(() => {
+ const newCount = isPC ? 3 : isTablet ? 2 : 1;
+ setCardCount(newCount);
+ }, [width]);
useEffect(() => {
setLinkCardList(initialLinkList, initialTotalCount);
@@ -94,6 +99,13 @@ const LinkPage = ({
// 링크페이지의 query가 바뀌면 새로운 리스트로 업데이트 해주는 훅
useFetchLinks(setLinkCardList, setIsLoading);
+ // 생성된 폴더가 없으면 폴더 생성 모달 띄워주기
+ useEffect(() => {
+ if (folderList.length === 0) {
+ toast.success(toastMessages.success.addFolderInfo);
+ openModal("AddFolderModal");
+ }
+ }, []);
return (
<>
@@ -120,8 +132,8 @@ const LinkPage = ({
)}
{isLoading ? (
-
- {[...Array(3)].map((_, index) => (
+
+ {[...Array(cardCount)].map((_, index) => (
))}
@@ -139,7 +151,6 @@ const LinkPage = ({
)}
- {isOpen &&
}
{isMobile && (
)}
diff --git a/styles/globals.css b/styles/globals.css
index 4bb4bc5..9fb8bde 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -62,3 +62,23 @@ em {
input {
outline: none;
}
+
+/* 스크롤 커스텀 */
+.scrollbar-custom {
+ overflow-y: auto; /* 기본 overflow-y-auto 추가 */
+}
+.scrollbar-custom::-webkit-scrollbar {
+ width: 8px;
+ height: 8px; /* 가로 스크롤바 높이 */
+}
+.scrollbar-custom::-webkit-scrollbar-track {
+ background: transparent;
+}
+.scrollbar-custom::-webkit-scrollbar-thumb {
+ background: #6d6afe;
+ border-radius: 9999px;
+}
+
+.scrollbar-custom::-webkit-scrollbar-thumb:hover {
+ background: #6d6afe;
+}