-
Notifications
You must be signed in to change notification settings - Fork 51
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
[박소현] week19 #556
The head ref may contain hidden characters: "part3-\uBC15\uC18C\uD604-week19"
[박소현] week19 #556
Conversation
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.
허허 저희팀 플젝은 끝났지만 그래두 소현님 코드는 못참지~!!!!! 궁금해서 보러왔는데 역시 넘 멋지시네용... 👀👀👀🙌 오늘도 배워갑니당 ㅋㅋㅋㅋ !!!
export interface LinkData { | ||
id: number; | ||
title: string; | ||
url: string; | ||
description: string; | ||
favorite: boolean; | ||
created_at: string; | ||
image_source: string; | ||
} |
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.
혹시 이렇게 하면 에러 안 나시나요???
저는 제가 직접 링크 하나 추가하고 보니까 link에 대한 img source랑 description이 없어서 에러가 떴었거든요,
그래서 id랑 url, created at 속성 빼고 다 ? 붙여서 옵셔널로 만들었던... ㅠㅠ
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.
재원님 저는 타입에러는 없었는데요, 링크 중에 이미지 소스가 있지만 이미지를 불러오지 못하는경우(404 에러)가 있어서 이때는 Image 컴포넌트에 onError 콜백함수로 대체 이미지를 주었습니다! (오늘 커밋 추가했습니당 ㅎㅎ)
description이 없는 경우는 아직 없었는데 혹시 테스트해보신 url 공유해주시면 저도 테스트 한번 해보겠습니다!
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.
저도 아무 url이나 추가하다 우연히 넣고 알게된건데... https://www.google.com 링크 추가하시면 image source도 description도 없어서 에러가 나더라구요!!
import { LinkData } from "@/types/link"; | ||
|
||
export const checkMatchedAllLinks = (keyword: string, links: LinkData[]) => { | ||
const filteredLinks = links.filter((link) => { | ||
return ( | ||
(link.title && link.title.includes(keyword)) || | ||
(link.description && link.description.includes(keyword)) || | ||
(link.url && link.url.includes(keyword)) | ||
); | ||
}); | ||
return filteredLinks; | ||
}; |
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.
오~!!! 이거 좋은 생각이네염 항상 느끼건데 소현님은 코드랑 파일 정리 넘 깔끔하게 잘하시는거 같아요, 부럽부럽....
src/components/card/CardItem.tsx
Outdated
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.
왕.... 코드 진짜루 깔끔 그잡채... ㅋㅋ ㅠㅠ 오늘도 배워갑니당 허허
과제에서 재원님 보니 더 반갑네요😋 프로젝트 기억이 새록새록 ㅎㅎ |
import type { StorybookConfig } from "@storybook/nextjs"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", |
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.
📌 멘토님, 이번주 스토리북 수강하면서 실습을 과제에서 하느라 요구사항 외 코드가 추가되었는데요,
이와 관련된 .storybook폴더 / components/story 폴더, src/stories 폴더는 스토리북 공부한 코드입니다!(리뷰x)
참고 부탁드립니다. 😆
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.
소현님 고생 많으셨습니다! 팀장님 덕분에 파트3 저도 많이 도움받은 것 같아요. 감사합니다 😊
마지막까지 파이팅입니다! 🔥🔥🔥
const [accessToken, setAccessToken] = useState<string | null>(); | ||
const [folderName, setFolderName] = useState(""); | ||
|
||
const fetcher = async (url: string, name: string) => { |
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.
여기서 POST 요청 후에 재검증이 필요한 값이 없나요?
import { DOMAIN_URL } from "@/common/constants"; | ||
import { SubmitFormData } from "@/types/form"; | ||
|
||
const headers = { "Content-Type": "application/json; charset=utf-8" }; |
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.
자주 쓰이는 header들을 const 파일에 두고 쓰면 좋을 것 같아요.
"@tanstack/react-query": "^5.17.9", | ||
"@tanstack/react-query-devtools": "^5.17.9", |
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.
react-query가 사용되지는 않는것 같은데 추가하신 이유가 있을까요?
@@ -51,7 +50,7 @@ export default function FolderUI(props: FolderUIProps) { | |||
)} | |||
<S.MenuContainer> | |||
<Categories | |||
categories={[DEFAULT, ...props.folderNames]} | |||
categories={["전체", ...props.folderNames]} |
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 && links.length === 0 ? ( | ||
<S.Blank>저장된 링크가 없습니다</S.Blank> | ||
) : ( | ||
<CardList links={filteredLinks} /> |
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.
filteredLinks
를 state로 두지 않는 것이 조금 더 괜찮을 것 같습니다.
<CardList links={filteredLinks} /> | |
<CardList links={checkMatchedAllLinks(keyword, links)} /> |
alt="link" | ||
className={cardStyle} | ||
fill | ||
onError={handleImageError} |
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.
Image 컴포넌트에 이런 기능도 있었군요! 👍
export default function DeleteFolder({ selectedItem, linkId, label, onClose }: DeleteFolderProps) { | ||
const router = useRouter(); | ||
const folderId = router.query.id; | ||
const [accessToken, setAccessToken] = useState<string | null>(); |
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.
accessToken을 로컬스토리지에서 가져오기 위해 useEffect를 활용한 로직이 모달 컴포넌트에 공통되는데 훅으로 만들어쓰면 좋을 것 같아요!
const router = useRouter(); | ||
const folderId = router.query.id; | ||
|
||
const [accessToken, setAccessToken] = useState<string | null>(); |
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.
👀
export default function AddLink({ link }: AddLinkProps) { | ||
const { folderNameList } = useContext(FolderContext); | ||
export default function AddLink({ link, onClose }: AddLinkProps) { | ||
const [accessToken, setAccessToken] = useState<string | null>(); |
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.
👀
}); | ||
|
||
export function FolderContextProvider({ children }: Props) { | ||
const DEFAULT = "전체"; |
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.
위에서 언급한 코멘트랑 관련하여 DEFAULT 값을 따로 빼서 공유하면 좋을 것 같아요!
요구사항
기본
주요 변경사항
멘토에게