From 6f172403ac5c3cefa0cd33b70a05723f0ed459ba Mon Sep 17 00:00:00 2001 From: junjeeong Date: Fri, 8 Nov 2024 17:42:58 +0900 Subject: [PATCH 01/13] =?UTF-8?q?Feat:=20Link=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B8=B0=EB=B3=B8=20ui=20=EA=B5=AC=ED=98=84,=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=ED=95=B4=EC=95=BC=20?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/link/index.tsx | 67 +++++++++++++++++++++++++++++++++++++++++ public/icons/delete.svg | 8 +++++ public/icons/pen.svg | 5 +++ public/icons/share.svg | 11 +++++++ 4 files changed, 91 insertions(+) create mode 100644 pages/link/index.tsx create mode 100644 public/icons/delete.svg create mode 100644 public/icons/pen.svg create mode 100644 public/icons/share.svg diff --git a/pages/link/index.tsx b/pages/link/index.tsx new file mode 100644 index 0000000..c53e56d --- /dev/null +++ b/pages/link/index.tsx @@ -0,0 +1,67 @@ +import { SearchInput } from "../../components/Search/SearchInput"; +import AddLinkInput from "../../components/Link/AddLinkInput"; +import Container from "@/components/Layout/Container"; +import FolderTag from "../../components/FolderTag"; +import CardsLayout from "@/components/Layout/CardsLayout"; +import CardItem from "@/components/CardItem"; +import Image from "next/image"; + +const LinkPage = () => { + return ( + <> +
+ +
+
+ + +
+ + +
+
+

유용한 글

+
+ + + +
+
+ + {list.map((link) => ( + + ))} + +
+
+ + ); +}; + +export default LinkPage; diff --git a/public/icons/delete.svg b/public/icons/delete.svg new file mode 100644 index 0000000..1923de9 --- /dev/null +++ b/public/icons/delete.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/public/icons/pen.svg b/public/icons/pen.svg new file mode 100644 index 0000000..fb75fc3 --- /dev/null +++ b/public/icons/pen.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/icons/share.svg b/public/icons/share.svg new file mode 100644 index 0000000..da9d0c1 --- /dev/null +++ b/public/icons/share.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + From 49ab5dfaa1a60dfd2ac12b80fdb34c1bea15b5f8 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Fri, 8 Nov 2024 17:49:37 +0900 Subject: [PATCH 02/13] =?UTF-8?q?Fix:=20CardItem=20->=20LinkCard=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/link/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/link/index.tsx b/pages/link/index.tsx index c53e56d..71be492 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -1,9 +1,9 @@ import { SearchInput } from "../../components/Search/SearchInput"; -import AddLinkInput from "../../components/Link/AddLinkInput"; import Container from "@/components/Layout/Container"; -import FolderTag from "../../components/FolderTag"; import CardsLayout from "@/components/Layout/CardsLayout"; -import CardItem from "@/components/CardItem"; +import AddLinkInput from "../../components/Link/AddLinkInput"; +import FolderTag from "../../components/FolderTag"; +import LinkCard from "../../components/LinkCard"; import Image from "next/image"; const LinkPage = () => { @@ -55,7 +55,7 @@ const LinkPage = () => { {list.map((link) => ( - + ))} From 536f59fd4a56182de2d9d848dc85552a6ded976b Mon Sep 17 00:00:00 2001 From: junjeeong Date: Fri, 8 Nov 2024 21:56:59 +0900 Subject: [PATCH 03/13] =?UTF-8?q?Updating:=20/link=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=EC=B6=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Link/ActionButtons.tsx | 18 ++++++++ pages/api/folders.ts | 42 ++++++++++++++++++ pages/api/links.ts | 42 ++++++++++++++++++ pages/link/index.tsx | 72 +++++++++++++++---------------- types/folder.ts | 6 +++ types/link.ts | 9 ++++ 6 files changed, 153 insertions(+), 36 deletions(-) create mode 100644 components/Link/ActionButtons.tsx create mode 100644 pages/api/folders.ts create mode 100644 pages/api/links.ts create mode 100644 types/folder.ts create mode 100644 types/link.ts diff --git a/components/Link/ActionButtons.tsx b/components/Link/ActionButtons.tsx new file mode 100644 index 0000000..7075ec6 --- /dev/null +++ b/components/Link/ActionButtons.tsx @@ -0,0 +1,18 @@ +import Image from "next/image"; + +const ActionButtons = () => ( +
+ {[ + { src: "/icons/share.svg", alt: "공유", text: "공유" }, + { src: "/icons/pen.svg", alt: "이름 변경", text: "이름 변경" }, + { src: "/icons/delete.svg", alt: "삭제", text: "삭제" }, + ].map(({ src, alt, text }) => ( + + ))} +
+); + +export default ActionButtons; diff --git a/pages/api/folders.ts b/pages/api/folders.ts new file mode 100644 index 0000000..e7b7f12 --- /dev/null +++ b/pages/api/folders.ts @@ -0,0 +1,42 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import { parse } from "cookie"; +import axiosInstance from "@/lib/api/axiosInstanceApi"; + +const handler = async (req: NextApiRequest, res: NextApiResponse) => { + const cookies = parse(req.headers.cookie || ""); + const accessToken = cookies.accessToken; + + switch (req.method) { + case "GET": + // 유저의 모든 폴더 조회 + try { + const response = await axiosInstance.get("/folders", { + headers: { Authorization: `Bearer ${accessToken}` }, + }); + return res.status(201).json(response.data); + } catch (err) { + console.error(err); + return res + .status(500) + .json({ message: "모든 폴저 조회에 실패했습니다." }); + } + + case "POST": + // 유저의 폴더 생성 + try { + const response = await axiosInstance.post("/folders", req.body, { + headers: { Authorization: `Bearer ${accessToken}` }, + }); + return res.status(201).json(response.data); + } catch (err) { + console.error(err); + return res.status(500).json({ message: "폴더 생성에 실패했습니다." }); + } + + default: + res.setHeader("Allow", ["GET", "POST"]); + return res.status(405).end(`메서드 ${req.method}는 허용되지 않습니다.`); + } +}; + +export default handler; diff --git a/pages/api/links.ts b/pages/api/links.ts new file mode 100644 index 0000000..9202a25 --- /dev/null +++ b/pages/api/links.ts @@ -0,0 +1,42 @@ +import { NextApiRequest, NextApiResponse } from "next"; +import { parse } from "cookie"; +import axiosInstance from "@/lib/api/axiosInstanceApi"; + +const handler = async (req: NextApiRequest, res: NextApiResponse) => { + const cookies = parse(req.headers.cookie || ""); + const accessToken = cookies.accessToken; + + switch (req.method) { + case "GET": + // 유저의 전체 링크 조회 + try { + const response = await axiosInstance.get("/links", { + headers: { Authorization: `Bearer ${accessToken}` }, + }); + return res.status(201).json(response.data); + } catch (err) { + console.error(err); + return res + .status(500) + .json({ message: "전체 링크 조회에 실패했습니다." }); + } + + case "POST": + // 링크 생성 로직 + try { + const response = axiosInstance.post("/links", req.body, { + headers: { Authorization: `Bearer ${accessToken}` }, + }); + return res.status(201).json(response.data); + } catch (err) { + console.error(err); + return res.status(500).json({ message: "링크 생성에 실패했습니다." }); + } + + default: + res.setHeader("Allow", ["GET", "POST"]); + return res.status(405).end(`메서드 ${req.method}는 허용되지 않습니다.`); + } +}; + +export default handler; diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 71be492..4a6d56c 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -1,62 +1,62 @@ +import { GetServerSidePropsContext } from "next"; +import { proxy } from "@/lib/api/axiosInstanceApi"; import { SearchInput } from "../../components/Search/SearchInput"; import Container from "@/components/Layout/Container"; import CardsLayout from "@/components/Layout/CardsLayout"; import AddLinkInput from "../../components/Link/AddLinkInput"; import FolderTag from "../../components/FolderTag"; import LinkCard from "../../components/LinkCard"; -import Image from "next/image"; +import ActionButtons from "@/components/Link/ActionButtons"; + +const getServerSideProps = async (context: GetServerSidePropsContext) => { + const { req } = context; + const { cookie } = req.headers; + + const fetchData = async (endpoint: string) => { + return await proxy.get(endpoint, { + headers: { + Cookie: cookie, + }, + }); + }; + + const links = await fetchData("/api/links"); + const folders = await fetchData("/api/folders"); + + return { + props: { + links: links.data, + folders: folders.data, + }, + }; +}; + +const LinkPage = ({ links, folders }) => { + console.log(links); + console.log(folders); -const LinkPage = () => { return ( <> -
- +
+ {/* */}
- + {/* */}

유용한 글

-
- - - -
+
- {list.map((link) => ( + {/* {links.map((link) => ( - ))} + ))} */}
diff --git a/types/folder.ts b/types/folder.ts new file mode 100644 index 0000000..8db6c6d --- /dev/null +++ b/types/folder.ts @@ -0,0 +1,6 @@ +export interface FolderData { + id: number; + createdAt: string; + name: string; + linkCount: number; +} diff --git a/types/link.ts b/types/link.ts new file mode 100644 index 0000000..96088c6 --- /dev/null +++ b/types/link.ts @@ -0,0 +1,9 @@ +export interface LinkData { + id: number; + favorite: boolean; + url: string; + title: string; + imageSource: string; + description: string; + createdAt: string; +} From 9af6e599664dd2a40aaecd58e2ccad691a0b3946 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 10:29:01 +0900 Subject: [PATCH 04/13] =?UTF-8?q?link=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FolderTag.tsx | 6 +++++- components/Link/ActionButtons.tsx | 2 +- pages/api/folders.ts | 2 ++ pages/api/links.ts | 6 +++++- types/{folder.ts => folderTypes.ts} | 0 types/{link.ts => linkTypes.ts} | 0 6 files changed, 13 insertions(+), 3 deletions(-) rename types/{folder.ts => folderTypes.ts} (100%) rename types/{link.ts => linkTypes.ts} (100%) diff --git a/components/FolderTag.tsx b/components/FolderTag.tsx index 9745c83..94b97b8 100644 --- a/components/FolderTag.tsx +++ b/components/FolderTag.tsx @@ -5,7 +5,11 @@ interface FolderData { linkCount: number; } -const FolderTag = (list: FolderData[]) => { +interface FolderTagProps { + list: FolderData[]; +} + +const FolderTag = ({ list }: FolderTagProps) => { const folderStyle = "py-[8px] px-[12px] border border-purple-100 rounded-md"; return ( diff --git a/components/Link/ActionButtons.tsx b/components/Link/ActionButtons.tsx index 7075ec6..b498677 100644 --- a/components/Link/ActionButtons.tsx +++ b/components/Link/ActionButtons.tsx @@ -7,7 +7,7 @@ const ActionButtons = () => ( { src: "/icons/pen.svg", alt: "이름 변경", text: "이름 변경" }, { src: "/icons/delete.svg", alt: "삭제", text: "삭제" }, ].map(({ src, alt, text }) => ( - diff --git a/pages/api/folders.ts b/pages/api/folders.ts index e7b7f12..d8301eb 100644 --- a/pages/api/folders.ts +++ b/pages/api/folders.ts @@ -6,6 +6,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { const cookies = parse(req.headers.cookie || ""); const accessToken = cookies.accessToken; + console.log("getFolder 요청 : ", accessToken); + switch (req.method) { case "GET": // 유저의 모든 폴더 조회 diff --git a/pages/api/links.ts b/pages/api/links.ts index 9202a25..53f0128 100644 --- a/pages/api/links.ts +++ b/pages/api/links.ts @@ -6,10 +6,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { const cookies = parse(req.headers.cookie || ""); const accessToken = cookies.accessToken; + console.log("서버에서 전달받은 쿠키의 값: ", cookies); + console.log("서버에서 전달받은 토큰의 값: ", accessToken); + switch (req.method) { case "GET": // 유저의 전체 링크 조회 try { + const response = await axiosInstance.get("/links", { headers: { Authorization: `Bearer ${accessToken}` }, }); @@ -24,7 +28,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { case "POST": // 링크 생성 로직 try { - const response = axiosInstance.post("/links", req.body, { + const response = await axiosInstance.post("/links", req.body, { headers: { Authorization: `Bearer ${accessToken}` }, }); return res.status(201).json(response.data); diff --git a/types/folder.ts b/types/folderTypes.ts similarity index 100% rename from types/folder.ts rename to types/folderTypes.ts diff --git a/types/link.ts b/types/linkTypes.ts similarity index 100% rename from types/link.ts rename to types/linkTypes.ts From 0924ff1bb9be0a5eb40f8d1fc4d887c73dd2358d Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 10:35:51 +0900 Subject: [PATCH 05/13] =?UTF-8?q?Feat=20:=20/link=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20SSR=EB=A1=9C=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=B0=9B=EC=95=84=EC=98=A4=EB=8A=94=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/link/index.tsx | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 4a6d56c..e2e537a 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -1,50 +1,57 @@ import { GetServerSidePropsContext } from "next"; import { proxy } from "@/lib/api/axiosInstanceApi"; import { SearchInput } from "../../components/Search/SearchInput"; +import { LinkData } from "@/types/linkTypes"; +import { FolderData } from "@/types/folderTypes"; import Container from "@/components/Layout/Container"; import CardsLayout from "@/components/Layout/CardsLayout"; -import AddLinkInput from "../../components/Link/AddLinkInput"; import FolderTag from "../../components/FolderTag"; import LinkCard from "../../components/LinkCard"; -import ActionButtons from "@/components/Link/ActionButtons"; +import AddLinkInput from "@/components/link/AddLinkInput"; +import ActionButtons from "@/components/link/ActionButtons"; -const getServerSideProps = async (context: GetServerSidePropsContext) => { +interface LinkPageProps { + links: LinkData[]; + folders: FolderData[]; +} +export const getServerSideProps = async ( + context: GetServerSidePropsContext +) => { const { req } = context; - const { cookie } = req.headers; const fetchData = async (endpoint: string) => { - return await proxy.get(endpoint, { + const response = await proxy.get(endpoint, { headers: { - Cookie: cookie, + Cookie: req.headers.cookie, }, }); + return response.data; }; - const links = await fetchData("/api/links"); - const folders = await fetchData("/api/folders"); + const [links, folders] = await Promise.all([ + fetchData("/api/links"), + fetchData("/api/folders"), + ]); return { props: { - links: links.data, - folders: folders.data, + links: links.list || [], // 기본값 처리 + folders: folders || [], // 기본값 처리 }, }; }; -const LinkPage = ({ links, folders }) => { - console.log(links); - console.log(folders); - +const LinkPage = ({ links, folders }: LinkPageProps) => { return ( <>
- {/* */} +
- {/* */} + @@ -54,9 +61,9 @@ const LinkPage = ({ links, folders }) => {
- {/* {links.map((link) => ( + {links.map((link) => ( - ))} */} + ))}
From f129f679d8bf055419ad4fe99826db9cf5b87d40 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 10:53:43 +0900 Subject: [PATCH 06/13] =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/link/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/link/index.tsx b/pages/link/index.tsx index e2e537a..51a84f9 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -44,8 +44,8 @@ export const getServerSideProps = async ( const LinkPage = ({ links, folders }: LinkPageProps) => { return ( <> -
- +
+
From 4027ea84808ce358397ab1b9a62d2d5977a57291 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 11:13:21 +0900 Subject: [PATCH 07/13] =?UTF-8?q?Feat:=20FolderTag=20handleSubmit=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FolderTag.tsx | 40 +++++++++++++++++++++---------- components/link/ContentHeader.tsx | 12 ++++++++++ components/link/FolderToolbar.tsx | 17 +++++++++++++ components/link/LinkList.tsx | 12 ++++++++++ 4 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 components/link/ContentHeader.tsx create mode 100644 components/link/FolderToolbar.tsx create mode 100644 components/link/LinkList.tsx diff --git a/components/FolderTag.tsx b/components/FolderTag.tsx index 4cf93fa..876e8fd 100644 --- a/components/FolderTag.tsx +++ b/components/FolderTag.tsx @@ -1,22 +1,38 @@ -interface FolderData { - id: number; - createdAt: string; - name: string; - linkCount: number; +import { useRouter } from "next/router"; +import { FolderData } from "@/types/folderTypes"; + +interface FolderTagProps { + list: FolderData[]; } -const FolderTag = (list: FolderData[]) => { - const folderStyle = "py-[8px] px-[12px] border border-[#6D6AFE] rounded-md"; +const FolderTag = ({ list }: FolderTagProps) => { + const router = useRouter(); + const { folder: currentFolderId } = router.query; + + const folderStyle = + "py-[8px] px-[12px] border border-purple100 rounded-md hover:bg-purple100 hover:text-white"; + + const handleSubmit = (id: number) => { + router.push({ + pathname: router.pathname, + query: { ...router.query, folder: id }, + }); + }; return ( -
-
전체
+
    + {list.map((folder) => ( -
    +
    + ))} -
+ ); }; diff --git a/components/link/ContentHeader.tsx b/components/link/ContentHeader.tsx new file mode 100644 index 0000000..fd97e72 --- /dev/null +++ b/components/link/ContentHeader.tsx @@ -0,0 +1,12 @@ +import ActionButtons from "./ActionButtons"; + +const ContentHeader = () => { + return ( +
+

유용한 글

+ +
+ ); +}; + +export default ContentHeader; diff --git a/components/link/FolderToolbar.tsx b/components/link/FolderToolbar.tsx new file mode 100644 index 0000000..a02c6d0 --- /dev/null +++ b/components/link/FolderToolbar.tsx @@ -0,0 +1,17 @@ +import { FolderData } from "@/types/folderTypes"; +import FolderTag from "../FolderTag"; + +interface FolderToolbarProps { + folders: FolderData[]; +} + +const FolderToolbar = ({ folders }: FolderToolbarProps) => { + return ( +
+ {folders && } + +
+ ); +}; + +export default FolderToolbar; diff --git a/components/link/LinkList.tsx b/components/link/LinkList.tsx new file mode 100644 index 0000000..e3385ef --- /dev/null +++ b/components/link/LinkList.tsx @@ -0,0 +1,12 @@ +import { LinkData } from "@/types/linkTypes"; +import LinkCard from "../LinkCard"; + +interface LinkListProps { + links: LinkData[]; +} + +const LinkList = ({ links }: LinkListProps) => { + return links.map((link) => ); +}; + +export default LinkList; From 98d1f38b6cbe5b056019a359818afbfb708c27fc Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 11:30:22 +0900 Subject: [PATCH 08/13] =?UTF-8?q?Fix=20:=20=EB=B0=9B=EB=8A=94=20prop=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20handleSubmit=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Link/AddLinkInput.tsx | 19 +++++++++++-------- pages/search/index.tsx | 0 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 pages/search/index.tsx diff --git a/components/Link/AddLinkInput.tsx b/components/Link/AddLinkInput.tsx index 2c684fc..019d05f 100644 --- a/components/Link/AddLinkInput.tsx +++ b/components/Link/AddLinkInput.tsx @@ -1,30 +1,33 @@ import { ChangeEvent, FormEvent, useState } from "react"; -import { postLink } from "@/lib/api/link"; +import { FolderData } from "@/types/folderTypes"; import Image from "next/image"; import SubmitButton from "../SubMitButton"; -const AddLinkInput = (folderId: number) => { - const [value, setValue] = useState(""); +interface AddLinkInputProps { + folderList: FolderData[]; +} + +const AddLinkInput = ({ folderList }: AddLinkInputProps) => { + const [link, setLink] = useState(""); const handleChange = (e: ChangeEvent) => { - setValue(e.target.value); + setLink(e.target.value); }; const handleSubmit = async (e: FormEvent) => { e.preventDefault(); - await postLink({ url: value, folderId }); - // postLink 하고 추가된 link가 보이도록 하는 로직 구현해야 함. + // Addmodal 띄우면서 link, folders 전달해주어야 함. }; return (
link icon diff --git a/pages/search/index.tsx b/pages/search/index.tsx new file mode 100644 index 0000000..e69de29 From 75fe98b596353662fc9ec23d34347814a09d224d Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 11:31:30 +0900 Subject: [PATCH 09/13] =?UTF-8?q?Fix=20:=20=EB=B0=9B=EB=8A=94=20prop=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20handleSubmit=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/folderTypes.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 types/folderTypes.ts diff --git a/types/folderTypes.ts b/types/folderTypes.ts new file mode 100644 index 0000000..8db6c6d --- /dev/null +++ b/types/folderTypes.ts @@ -0,0 +1,6 @@ +export interface FolderData { + id: number; + createdAt: string; + name: string; + linkCount: number; +} From 787d8e89d957bbbb944c715f23088938ade2559e Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 11:36:56 +0900 Subject: [PATCH 10/13] =?UTF-8?q?Feat:=20tag=20hover=20=EA=B8=B0=EB=8A=A5,?= =?UTF-8?q?=20=EC=84=A0=ED=83=9D=EB=90=9C=20tag=20=EB=B0=B0=EA=B2=BD?= =?UTF-8?q?=EC=83=89=20=EC=B6=94=EA=B0=80,=20tag=20=EB=88=8C=EB=A0=80?= =?UTF-8?q?=EC=9D=84=20=EB=95=8C=20router.push=20=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FolderTag.tsx | 6 +++--- components/link/ContentHeader.tsx | 12 ------------ components/link/FolderToolbar.tsx | 17 ----------------- components/link/LinkList.tsx | 12 ------------ types/folderTypes.ts | 6 ++++++ 5 files changed, 9 insertions(+), 44 deletions(-) delete mode 100644 components/link/ContentHeader.tsx delete mode 100644 components/link/FolderToolbar.tsx delete mode 100644 components/link/LinkList.tsx create mode 100644 types/folderTypes.ts diff --git a/components/FolderTag.tsx b/components/FolderTag.tsx index 876e8fd..54b528b 100644 --- a/components/FolderTag.tsx +++ b/components/FolderTag.tsx @@ -2,10 +2,10 @@ import { useRouter } from "next/router"; import { FolderData } from "@/types/folderTypes"; interface FolderTagProps { - list: FolderData[]; + folderList: FolderData[]; } -const FolderTag = ({ list }: FolderTagProps) => { +const FolderTag = ({ folderList }: FolderTagProps) => { const router = useRouter(); const { folder: currentFolderId } = router.query; @@ -22,7 +22,7 @@ const FolderTag = ({ list }: FolderTagProps) => { return (
    - {list.map((folder) => ( + {folderList.map((folder) => ( -
- ); -}; - -export default FolderToolbar; diff --git a/components/link/LinkList.tsx b/components/link/LinkList.tsx deleted file mode 100644 index e3385ef..0000000 --- a/components/link/LinkList.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { LinkData } from "@/types/linkTypes"; -import LinkCard from "../LinkCard"; - -interface LinkListProps { - links: LinkData[]; -} - -const LinkList = ({ links }: LinkListProps) => { - return links.map((link) => ); -}; - -export default LinkList; diff --git a/types/folderTypes.ts b/types/folderTypes.ts new file mode 100644 index 0000000..8db6c6d --- /dev/null +++ b/types/folderTypes.ts @@ -0,0 +1,6 @@ +export interface FolderData { + id: number; + createdAt: string; + name: string; + linkCount: number; +} From b13ed236868c53fceffbf8d21fee886c590f146c Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 11:45:50 +0900 Subject: [PATCH 11/13] =?UTF-8?q?Fix:=20ci=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EA=B3=A0=EC=B9=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/index.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pages/search/index.tsx diff --git a/pages/search/index.tsx b/pages/search/index.tsx deleted file mode 100644 index e69de29..0000000 From f6f58b77c9f9111f43332a68d4d7cce0efb5a449 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 23:43:37 +0900 Subject: [PATCH 12/13] =?UTF-8?q?Fix:=20#65=20Pr=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B0=9B=EC=9D=80=20=ED=94=BC=EB=93=9C=EB=B0=B1=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FolderTag.tsx | 25 ++++++++++++++----------- components/Link/AddLinkInput.tsx | 28 ++++++++++++++++------------ components/LinkCard.tsx | 25 ++++++++++++------------- pages/favorite/index.tsx | 11 +---------- pages/link/index.tsx | 2 +- 5 files changed, 44 insertions(+), 47 deletions(-) diff --git a/components/FolderTag.tsx b/components/FolderTag.tsx index 734c97d..33e91b4 100644 --- a/components/FolderTag.tsx +++ b/components/FolderTag.tsx @@ -17,18 +17,21 @@ const FolderTag = ({ folderList }: FolderListData) => { return (
    - - {folderList.map((folder) => ( - + + {folderList.map((folder) => ( +
  • + +
  • ))}
); diff --git a/components/Link/AddLinkInput.tsx b/components/Link/AddLinkInput.tsx index 0ef41b8..add6904 100644 --- a/components/Link/AddLinkInput.tsx +++ b/components/Link/AddLinkInput.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, FormEvent, useState } from "react"; +import { ChangeEvent, KeyboardEvent, useState } from "react"; import { FolderListData } from "@/types/folderTypes"; import Image from "next/image"; import SubmitButton from "../SubMitButton"; @@ -10,27 +10,31 @@ const AddLinkInput = ({ folderList }: FolderListData) => { setLink(e.target.value); }; - const handleSubmit = async (e: FormEvent) => { - e.preventDefault(); - // Addmodal 띄우면서 link, folders 전달해주어야 함. + const handleClick = () => { + // Addmodal 띄우면서 link 전달 + }; + + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === "Enter") { + e.preventDefault(); + handleClick(); + } }; return ( - +
link icon - - 추가하기 - - +
+ 추가하기 +
+
); }; diff --git a/components/LinkCard.tsx b/components/LinkCard.tsx index e84edb3..dbb2e77 100644 --- a/components/LinkCard.tsx +++ b/components/LinkCard.tsx @@ -2,21 +2,20 @@ import { useState } from "react"; import timeAgo from "@/util/timAgo"; import Image from "next/image"; -interface linkDataType { - id: number; - title: string; - description: string; - favorite?: boolean; - imageSource: string; - url: string; - createdAt: string; +interface LinkCardProps { + info: { + id: number; + title: string; + description: string; + favorite?: boolean; + imageSource: string; + url: string; + createdAt: string; + }; + isFavoritePage?: boolean; } -interface CardItemProps extends linkDataType { - isFavoritePage?: boolean; // 즐겨찾기 페이지 여부를 판별하는 flag -} - -const LinkCard = ({ isFavoritePage, ...info }: CardItemProps) => { +const LinkCard = ({ isFavoritePage, info }: LinkCardProps) => { const [isSubscribed, setIsSubscribed] = useState(false); const [isOpen, setIsOpen] = useState(false); diff --git a/pages/favorite/index.tsx b/pages/favorite/index.tsx index d5a345a..5b8a46d 100644 --- a/pages/favorite/index.tsx +++ b/pages/favorite/index.tsx @@ -54,16 +54,7 @@ const FavoritePage = ({ favoriteList, totalCount }: FavoriteProps) => { {favoriteList.length > 0 ? favoriteList.map((favorite) => ( - + )) : null} diff --git a/pages/link/index.tsx b/pages/link/index.tsx index 6a16026..b54b43f 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -5,8 +5,8 @@ import { FolderData } from "@/types/folderTypes"; import { SearchInput } from "../../components/Search/SearchInput"; import Container from "@/components/Layout/Container"; import CardsLayout from "@/components/Layout/CardsLayout"; -import AddLinkInput from "@/components/link/AddLinkInput"; import ActionButtons from "@/components/link/ActionButtons"; +import AddLinkInput from "@/components/link/AddLinkInput"; import FolderTag from "../../components/FolderTag"; import LinkCard from "../../components/LinkCard"; From bac1868639489578b1b904469789f15ba5538e58 Mon Sep 17 00:00:00 2001 From: junjeeong Date: Sun, 10 Nov 2024 23:47:26 +0900 Subject: [PATCH 13/13] =?UTF-8?q?Fix:=20CI=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/link/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/link/index.tsx b/pages/link/index.tsx index b54b43f..11b9bca 100644 --- a/pages/link/index.tsx +++ b/pages/link/index.tsx @@ -5,8 +5,8 @@ import { FolderData } from "@/types/folderTypes"; import { SearchInput } from "../../components/Search/SearchInput"; import Container from "@/components/Layout/Container"; import CardsLayout from "@/components/Layout/CardsLayout"; -import ActionButtons from "@/components/link/ActionButtons"; -import AddLinkInput from "@/components/link/AddLinkInput"; +import ActionButtons from "@/components/Link/ActionButtons"; +import AddLinkInput from "@/components/Link/AddLinkInput"; import FolderTag from "../../components/FolderTag"; import LinkCard from "../../components/LinkCard";