[정상인] sprint9#142
Merged
kiJu2 merged 33 commits intocodeit-bootcamp-frontend:Next-정상인from Nov 3, 2025
Hidden character warning
The head ref may contain hidden characters: "Next-\uc815\uc0c1\uc778-sprint9"
Merged
Conversation
…Sprint-Mission into Next-정상인-sprint9
Collaborator
|
스프리트 미션 하시느라 수고 많으셨어요. |
Collaborator
앞으로 App router를 사용할 일이 많을 것 같아서 복습 겸 page router를 사용했습니다.크으 ~ 좋습니다 ! 심화 프로젝트 시작 전에 감을 유지하기 위해서 요구사항만 정말 가볍게 만들었습니다. 순한 맛으로 부탁드려요 ㅠㅠ ^^;넵넵 ~! ㅎㅎㅎ 참고해서 리뷰하도록 하겠습니다 ! |
kiJu2
approved these changes
Nov 3, 2025
Comment on lines
+4
to
+18
| interface PostTodoRequest { | ||
| name: string; | ||
| } | ||
|
|
||
| export interface PostTodoResponse extends TodoItem { | ||
| tenantId: string; | ||
| memo: string; | ||
| imageUrl: string; | ||
| } | ||
|
|
||
| export const postTodo = async ({ | ||
| name, | ||
| }: PostTodoRequest): Promise<PostTodoResponse> => { | ||
| return instance.post("/items", { name }); | ||
| }; |
Collaborator
There was a problem hiding this comment.
굿굿 ! 응답과 요청 타입을 정의하셨군요 !
이제 타입스크립트에 완전 적응하신게 느껴집니다 👍👍👍👍
| return ( | ||
| <span | ||
| className={`${styles.badge} ${styles[variants]} ${className ?? ""}`} | ||
| aria-label={variantsToLabel[variants]} |
Comment on lines
+3
to
+13
| const variantsToLabel = { | ||
| todo: "TO DO", | ||
| done: "DONE", | ||
| }; | ||
|
|
||
| interface BadgeProps { | ||
| variants: keyof typeof variantsToLabel; | ||
| className?: string; | ||
| } | ||
|
|
||
| const Badge = ({ variants, className }: BadgeProps) => { |
Collaborator
There was a problem hiding this comment.
(의견/선택) Badge는 흔히 사용되는 유저 인터페이스예요 !
근데 지금 정의하신걸 보니까 해당 뱃지는 공통으로 사용되는 흔한 뱃지가 아니라 상태에 대한 뱃지를 표현하고 있는 것으로 보이는군요?
StatusBadge와 같이 네이밍을 해도 괜찮을 것 같습니다 !
Comment on lines
+19
to
+30
| export const getServerSideProps = async () => { | ||
| try { | ||
| const response = await getTodos(); | ||
| return { | ||
| props: { | ||
| todos: response, | ||
| }, | ||
| }; | ||
| } catch (error) { | ||
| console.error(error); | ||
| } | ||
| }; |
Collaborator
There was a problem hiding this comment.
크으 ~ 적절한 SSR 활용이네요 👍
이렇게 되면 페이지를 그려주는 속도가 훨씬 빠르겠어요 👍
Comment on lines
+14
to
+25
| <search> | ||
| <form className={styles.form} onSubmit={onSubmit}> | ||
| <input | ||
| className={`${styles.input} font-regular-16`} | ||
| value={value} | ||
| onChange={onChange} | ||
| type="text" | ||
| placeholder="할 일을 입력해주세요" | ||
| /> | ||
| <Button variants="append" type="submit" disabled={isDisabled} /> | ||
| </form> | ||
| </search> |
Collaborator
There was a problem hiding this comment.
크으 ~ HTML에 대해서 꼼꼼히 공부하신게 느껴집니다.
와우 search 태그를 쓰시는 수강생님은 처음 봤어요 👍👍👍
영역에 대한 의미가 확실하네요 훌륭합니다
Comment on lines
+35
to
+58
| const [isDisabled, setIsDisabled] = useState(false); | ||
|
|
||
| const completedTodos: TodoItem[] = []; | ||
| const pendingTodos: TodoItem[] = []; | ||
|
|
||
| todos.forEach((todo) => { | ||
| if (todo.isCompleted) completedTodos.push(todo); | ||
| else pendingTodos.push(todo); | ||
| }); | ||
|
|
||
| const handleSearchTermSubmit = async (e: FormEvent<HTMLFormElement>) => { | ||
| e.preventDefault(); | ||
| setIsDisabled(true); | ||
| try { | ||
| await postTodo({ name: searchTerm }); | ||
| const updatedTodos = await getTodos(); | ||
| setTodos(updatedTodos); | ||
| setSearchTerm(""); | ||
| } catch (error) { | ||
| console.error(error); | ||
| } finally { | ||
| setIsDisabled(false); | ||
| } | ||
| }; |
Collaborator
There was a problem hiding this comment.
만약 중복 요청을 방지하는 거라면 disabled 상태를 제거하고 useTransition을 사용해볼 수 있습니다 !
다음과 같이 사용해볼 수 있어요 !
const [isPending, startTransition] = useTransition();
const handleSearchTermSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
startTransition(async () => {
try {
await postTodo({ name: searchTerm });
const updatedTodos = await getTodos();
setTodos(updatedTodos);
setSearchTerm("");
} catch (error) {
console.error(error);
}
});
};
Collaborator
|
크으 ~ 수고하셨습니다 상인님 ! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
요구사항
기본
스크린샷
멘토에게