-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: 링크 검색 기능, 링크 추가 기능 구현 #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
The head ref may contain hidden characters: "feature/Link-\uD398\uC774\uC9C0"
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7dd4754
Feat: 검색했을 때 000으로 검색했습니다. 문구 표시 뜨게 하는 UI 추가
junjeeong 4055f2b
Working: 링크 검색, 추가 기능 작업중
junjeeong 6eaaace
Feat: 링크 검색기능 추가, CardsLayout margin 추가
junjeeong 68874c1
Feat: 링크 추가하기 기본 기능 구현
junjeeong db99170
Fix: input에 값 남는 버그, CI 버그 해결
junjeeong ba25f72
Fix: console.log 삭제
junjeeong 729e5a5
Merge branch 'develop' into feature/Link-페이지
junjeeong b00868b
Feat: 폴더추가 기능 구현
junjeeong 866a0f4
Feat: 폴더 추가 기능
junjeeong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { FolderData } from "@/types/folderTypes"; | ||
| import useModalStore from "@/store/useModalStore"; | ||
| import useRerenderFolderList from "@/hooks/useRerenderFolderList"; | ||
|
|
||
| interface AddFolderButtonProps { | ||
| setFolderList: React.Dispatch<React.SetStateAction<FolderData[]>>; | ||
| } | ||
|
|
||
| export const AddFolderButton = ({ setFolderList }: AddFolderButtonProps) => { | ||
| const { isOpen, openModal } = useModalStore(); | ||
|
|
||
| useRerenderFolderList(isOpen, setFolderList); | ||
|
|
||
| return ( | ||
| <button | ||
| className="w-[79px] h-[19px] text-purple100" | ||
| onClick={() => openModal("AddFolderModal")} | ||
| > | ||
| 폴더 추가 + | ||
| </button> | ||
| ); | ||
| }; | ||
| export default AddFolderButton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { FolderData } from "@/types/folderTypes"; | ||
| import Image from "next/image"; | ||
| import useModalStore from "@/store/useModalStore"; | ||
| import useRerenderFolderList from "../../hooks/useRerenderFolderList"; | ||
|
|
||
| interface FolderActionsMenuProps { | ||
| setFolderList: React.Dispatch<React.SetStateAction<FolderData[]>>; | ||
| } | ||
|
|
||
| const FolderActionsMenu = ({ setFolderList }: FolderActionsMenuProps) => { | ||
| const { isOpen, openModal } = useModalStore(); | ||
|
|
||
| const handleModalOpen = (text: string) => { | ||
| switch (text) { | ||
| case "공유": | ||
| openModal("SNSModal"); | ||
| break; | ||
| case "이름 변경": | ||
| openModal("EditModal"); | ||
| break; | ||
| case "삭제": | ||
| openModal("DeleteFolderModal"); | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| }; | ||
|
|
||
| useRerenderFolderList(isOpen, setFolderList); | ||
|
|
||
| return ( | ||
| <div className="w-[192px] h-[18px] flex justify-between gap-[12px] text-gray400"> | ||
| {[ | ||
| { src: "/icons/share.svg", alt: "공유", text: "공유" }, | ||
| { src: "/icons/pen.svg", alt: "이름 변경", text: "이름 변경" }, | ||
| { src: "/icons/delete.svg", alt: "삭제", text: "삭제" }, | ||
| ].map(({ src, alt, text }) => ( | ||
| <button | ||
| key={text} | ||
| className="flex items-center gap-[4px] text-sm" | ||
| onClick={() => handleModalOpen(text)} | ||
| > | ||
| <Image width={18} height={18} src={src} alt={alt} /> | ||
| <span>{text}</span> | ||
| </button> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default FolderActionsMenu; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| interface SearchResultMessageProps { | ||
| message: string | string[]; | ||
| } | ||
|
|
||
| const SearchResultMessage = ({ message }: SearchResultMessageProps) => { | ||
| return ( | ||
| <div className="text-[32px] text-gray400 mt-[40px]"> | ||
| <span className="text-black300">"{message}"</span>으로 검색한 | ||
| 결과입니다. | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default SearchResultMessage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { useEffect } from "react"; | ||
| import { proxy } from "@/lib/api/axiosInstanceApi"; | ||
| import { LinkData } from "@/types/linkTypes"; | ||
|
|
||
| // 검색어에 맞는 리스트로 setLinkCardList 해주는 함수 | ||
| const useFetchLinks = ( | ||
| search: string | string[] | undefined, | ||
| setLinkCardList: (list: LinkData[]) => void | ||
| ) => { | ||
| useEffect(() => { | ||
| const fetchLinks = async () => { | ||
| const res = await proxy.get("/api/links", { params: { search } }); | ||
| setLinkCardList(res.data.list); | ||
| }; | ||
| if (search) fetchLinks(); | ||
| }, [search, setLinkCardList]); | ||
| }; | ||
|
|
||
| export default useFetchLinks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { useEffect, useRef } from "react"; | ||
| import { getFolders } from "@/lib/api/folder"; | ||
| import { FolderData } from "@/types/folderTypes"; | ||
|
|
||
| // Folder 관련 드랍다운이 닫혔을 때 화면에 update된 FolderList를 보여주는 커스텀 훅 | ||
| const useRerenderFolderList = ( | ||
| isOpen: boolean, | ||
| setFolderList: React.Dispatch<React.SetStateAction<FolderData[]>> | ||
| ) => { | ||
| const isFirstRender = useRef(true); | ||
|
|
||
| useEffect(() => { | ||
| if (isFirstRender.current) { | ||
| isFirstRender.current = false; | ||
| return; // 최초 로드 시에 불필요한 fetch 요청을 막아줌. | ||
| } | ||
|
|
||
| const fetchNewFolderList = async () => { | ||
| const res = await getFolders(); | ||
| setFolderList(res); | ||
| }; | ||
|
|
||
| if (!isOpen) { | ||
| fetchNewFolderList(); // 드랍다운이 한번 열리고 닫혔을 때 데이터 fetch | ||
| } | ||
| }, [isOpen, setFolderList]); | ||
| }; | ||
|
|
||
| export default useRerenderFolderList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { proxy } from "./axiosInstanceApi"; | ||
|
|
||
| // SSR에서 proxy로 요청 보낼 때 사용하는 로직 ㅜㅊ상화 | ||
| const fetchProxy = async (endpoint: string, req: any) => { | ||
| const headers = req ? { Cookie: req.headers.cookie } : undefined; | ||
| const response = await proxy.get(endpoint, { headers }); | ||
| return response.data; | ||
| }; | ||
|
|
||
| export default fetchProxy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘 적용해주셨군요👍
영상 올려주신거 보니까 모달 한번 클릭하면 isLoading & 버튼 disabled 처리해서 중복으로 추가 방지하도록 해야겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
링크 추가 후에도 인풋에 입력값이 남아있어서 여기서 초기값 "" 으로 setLink 해주는게 좋을것같아요!