From 17ac0bf34dc562e30a4fc04bb8dc9fbb1a1c903e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=87=E1=85=A9=E1=84=80?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Mon, 1 Apr 2024 03:12:10 +0900 Subject: [PATCH 01/17] =?UTF-8?q?feat:=20part2=20=3D>=20part3=20=EC=9D=B4?= =?UTF-8?q?=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + README.md | 6 +- app/folder/page.tsx | 40 + app/layout.tsx | 18 + app/page.module.scss | 3 + app/page.tsx | 10 + app/shared/page.tsx | 33 + next.config.js | 6 - next.config.mjs | 78 + package-lock.json | 1800 ++++++++++++----- package.json | 11 +- pages/_app.tsx | 6 - pages/_document.tsx | 13 - pages/api/hello.ts | 13 - pages/index.tsx | 114 -- public/favicon.ico | Bin 25931 -> 0 bytes public/next.svg | 1 - public/vercel.svg | 1 - src/asset/index.ts | 10 + src/asset/svg/ChainIcon.tsx | 26 + src/asset/svg/EyeIcon.tsx | 41 + src/asset/svg/LinkImageEmptyCase.tsx | 50 + src/asset/svg/LinkbraryLogo.tsx | 50 + src/asset/svg/MagnifierIcon.tsx | 26 + src/asset/svg/WhiteFacebookIcon.tsx | 20 + src/asset/svg/WhiteInstagramIcon.tsx | 18 + src/asset/svg/WhiteTwitterIcon.tsx | 18 + src/asset/svg/WhiteYoutubeIcon.tsx | 25 + src/asset/svg/XIcon.tsx | 25 + .../AuthForm/AuthLabel/AuthLabel.tsx | 10 + .../Footer/Footer/Footer.module.scss | 22 + src/components/Footer/Footer/Footer.tsx | 34 + src/components/Footer/index.ts | 1 + .../Header/Header/Header.module.scss | 53 + src/components/Header/Header/Header.tsx | 35 + src/components/Header/index.ts | 1 + src/components/Input/Input.tsx | 3 + .../AddLinkBar/AddLinkBar.module.scss | 48 + .../LinkManager/AddLinkBar/AddLinkBar.tsx | 27 + .../FavoriteButton/FavoriteButton.module.scss | 22 + .../FavoriteButton/FavoriteButton.tsx | 22 + .../FavoriteButtonList.module.scss | 28 + .../FavoriteButtonList/FavoriteButtonList.tsx | 27 + .../LinkEmptyCase/LinkEmptyCase.module.scss | 16 + .../LinkList/LinkEmptyCase/LinkEmptyCase.tsx | 9 + .../LinkManager/LinkList/LinkList.module.scss | 7 + .../LinkManager/LinkList/LinkList.tsx | 17 + .../LinkList/LinkOverview/LinkOverView.tsx | 49 + .../LinkOverview/LinkOverview.module.scss | 68 + .../LinkManager/LinkManager.module.scss | 22 + src/components/LinkManager/LinkManager.tsx | 135 ++ .../LinkSearchBar/LinkSearchBar.module.scss | 35 + .../LinkSearchBar/LinkSearchBar.tsx | 24 + .../UserProfile/UserProfile.module.scss | 35 + .../LinkManager/UserProfile/UserProfile.tsx | 26 + src/constants/index.ts | 14 + src/constants/types.ts | 38 + src/hooks/useFetchData.ts | 12 + src/hooks/useGetData.ts | 21 + src/hooks/useIntersectionObserver.ts | 37 + src/styles/global.scss | 18 + src/styles/reset.scss | 129 ++ src/utils/getElapsedTime.ts | 41 + src/utils/getFormattedDate.ts | 7 + src/utils/getFormattedLinks.ts | 21 + styles/Home.module.css | 229 --- styles/globals.css | 107 - tsconfig.json | 14 +- 68 files changed, 2887 insertions(+), 1041 deletions(-) create mode 100644 app/folder/page.tsx create mode 100644 app/layout.tsx create mode 100644 app/page.module.scss create mode 100644 app/page.tsx create mode 100644 app/shared/page.tsx delete mode 100644 next.config.js create mode 100644 next.config.mjs delete mode 100644 pages/_app.tsx delete mode 100644 pages/_document.tsx delete mode 100644 pages/api/hello.ts delete mode 100644 pages/index.tsx delete mode 100644 public/favicon.ico delete mode 100644 public/next.svg delete mode 100644 public/vercel.svg create mode 100644 src/asset/index.ts create mode 100644 src/asset/svg/ChainIcon.tsx create mode 100644 src/asset/svg/EyeIcon.tsx create mode 100644 src/asset/svg/LinkImageEmptyCase.tsx create mode 100644 src/asset/svg/LinkbraryLogo.tsx create mode 100644 src/asset/svg/MagnifierIcon.tsx create mode 100644 src/asset/svg/WhiteFacebookIcon.tsx create mode 100644 src/asset/svg/WhiteInstagramIcon.tsx create mode 100644 src/asset/svg/WhiteTwitterIcon.tsx create mode 100644 src/asset/svg/WhiteYoutubeIcon.tsx create mode 100644 src/asset/svg/XIcon.tsx create mode 100644 src/components/AuthForm/AuthLabel/AuthLabel.tsx create mode 100644 src/components/Footer/Footer/Footer.module.scss create mode 100644 src/components/Footer/Footer/Footer.tsx create mode 100644 src/components/Footer/index.ts create mode 100644 src/components/Header/Header/Header.module.scss create mode 100644 src/components/Header/Header/Header.tsx create mode 100644 src/components/Header/index.ts create mode 100644 src/components/Input/Input.tsx create mode 100644 src/components/LinkManager/AddLinkBar/AddLinkBar.module.scss create mode 100644 src/components/LinkManager/AddLinkBar/AddLinkBar.tsx create mode 100644 src/components/LinkManager/FavoriteButtonList/FavoriteButton/FavoriteButton.module.scss create mode 100644 src/components/LinkManager/FavoriteButtonList/FavoriteButton/FavoriteButton.tsx create mode 100644 src/components/LinkManager/FavoriteButtonList/FavoriteButtonList.module.scss create mode 100644 src/components/LinkManager/FavoriteButtonList/FavoriteButtonList.tsx create mode 100644 src/components/LinkManager/LinkList/LinkEmptyCase/LinkEmptyCase.module.scss create mode 100644 src/components/LinkManager/LinkList/LinkEmptyCase/LinkEmptyCase.tsx create mode 100644 src/components/LinkManager/LinkList/LinkList.module.scss create mode 100644 src/components/LinkManager/LinkList/LinkList.tsx create mode 100644 src/components/LinkManager/LinkList/LinkOverview/LinkOverView.tsx create mode 100644 src/components/LinkManager/LinkList/LinkOverview/LinkOverview.module.scss create mode 100644 src/components/LinkManager/LinkManager.module.scss create mode 100644 src/components/LinkManager/LinkManager.tsx create mode 100644 src/components/LinkManager/LinkSearchBar/LinkSearchBar.module.scss create mode 100644 src/components/LinkManager/LinkSearchBar/LinkSearchBar.tsx create mode 100644 src/components/LinkManager/UserProfile/UserProfile.module.scss create mode 100644 src/components/LinkManager/UserProfile/UserProfile.tsx create mode 100644 src/constants/index.ts create mode 100644 src/constants/types.ts create mode 100644 src/hooks/useFetchData.ts create mode 100644 src/hooks/useGetData.ts create mode 100644 src/hooks/useIntersectionObserver.ts create mode 100644 src/styles/global.scss create mode 100644 src/styles/reset.scss create mode 100644 src/utils/getElapsedTime.ts create mode 100644 src/utils/getFormattedDate.ts create mode 100644 src/utils/getFormattedLinks.ts delete mode 100644 styles/Home.module.css delete mode 100644 styles/globals.css diff --git a/.gitignore b/.gitignore index 8f322f0d8f..cce881f090 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /node_modules /.pnp .pnp.js +.yarn/install-state.gz # testing /coverage @@ -33,3 +34,4 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts +node_modules diff --git a/README.md b/README.md index a75ac52488..c4033664f8 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,7 @@ bun dev Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. - -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. - -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. +You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. diff --git a/app/folder/page.tsx b/app/folder/page.tsx new file mode 100644 index 0000000000..b06220da32 --- /dev/null +++ b/app/folder/page.tsx @@ -0,0 +1,40 @@ +import { Footer } from "@/src/components/Footer"; +import { Header } from "@/src/components/Header"; +import LinkManager from "@/src/components/LinkManager/LinkManager"; +import { END_POINT } from "@/src/constants"; +import getFormattedLinks from "@/src/utils/getFormattedLinks"; +import { useRef } from "react"; +// import { useFetchData } from "@/src/hooks/useFetchData"; +// page 컴포넌트 안에서 useFetchData 사용시 eslint - hooks rule에 저촉 + +async function getFetchData(url: string) { + try { + const res = await fetch(url); + const result = await res.json(); + return result; + } catch (error) { + if (error instanceof Error) { + // alert(error.message); + console.error(error.message); + } + } +} + +// use Hooks 사용 불가 +export default async function page() { + // links data fetch + const linksData = await getFetchData(END_POINT.LINKS); + // const linksData = await useFetchData(END_POINT.LINKS); + // links data formatting + const links = getFormattedLinks(linksData.data); + // favorites data fetch + const favorites = await getFetchData(END_POINT.FOLDERS); + + return ( + <> +
+ +