-
Notifications
You must be signed in to change notification settings - Fork 8
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
[FE] useSelectedFeedbackData 훅 오류 해결(#783) #784
Changes from all commits
f5ab3f1
7b33404
3f60754
3032244
b387d8f
6518e01
c41e97c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import React from "react"; | ||
import { FeedbackType } from "@/hooks/feedback/useSelectedFeedbackData"; | ||
import Carousel from "@/components/common/carousel/Carousel"; | ||
import Label from "@/components/common/label/Label"; | ||
import FeedbackCard from "@/components/feedback/feedbackCard/FeedbackCard"; | ||
import * as S from "@/components/feedback/feedbackCardList/FeedbackCardList.style"; | ||
import { FeedbackCardDataList } from "@/@types/feedback"; | ||
import { FeedbackCardDataList, FeedbackType } from "@/@types/feedback"; | ||
import { defaultCharacter } from "@/assets"; | ||
import { HoverStyledLink } from "@/styles/common"; | ||
import { theme } from "@/styles/theme"; | ||
|
@@ -14,14 +13,20 @@ interface FeedbackCardListProps { | |
feedbackData: FeedbackCardDataList[]; | ||
selectedFeedback: number | undefined; | ||
handleSelectedFeedback: (roomId: number) => void; | ||
handleDeselectedFeedback: () => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 뜬금없지만 DeSelected 가 처음에는 없는 단어인줄 알았는데 실제로 사용되는 단어였네요! 하나 배워갑니당 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저도 저 단어 처음 보는데 gpt가 선택 해제할 때 쓰는 단어라고 알려줘서 사용했습니다ㅎㅅㅎ |
||
} | ||
|
||
const FeedbackCardList = ({ | ||
selectedFeedbackType, | ||
feedbackData, | ||
selectedFeedback, | ||
handleSelectedFeedback, | ||
handleDeselectedFeedback, | ||
}: FeedbackCardListProps) => { | ||
const toggleFeedbackSelection = (roomId: number) => { | ||
roomId === selectedFeedback ? handleDeselectedFeedback() : handleSelectedFeedback(roomId); | ||
}; | ||
|
||
Comment on lines
+26
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이렇게 수정되니 좋네요! |
||
if (feedbackData.length === 0) { | ||
return ( | ||
<S.EmptyContainer> | ||
|
@@ -42,14 +47,14 @@ const FeedbackCardList = ({ | |
<React.Fragment key={feedback.roomId}> | ||
<S.FeedbackMissionWrapper | ||
$isSelected={selectedFeedback === feedback.roomId} | ||
onClick={() => handleSelectedFeedback(feedback.roomId)} | ||
onClick={() => toggleFeedbackSelection(feedback.roomId)} | ||
role="listitem" | ||
aria-expanded={selectedFeedback === feedback.roomId} | ||
tabIndex={0} | ||
onKeyDown={(e) => { | ||
if (e.key === "Enter" || e.key === " ") { | ||
e.preventDefault(); | ||
handleSelectedFeedback(feedback.roomId); | ||
toggleFeedbackSelection(feedback.roomId); | ||
} | ||
}} | ||
aria-label={`${feedbackData.length}개의 미션 중 ${index + 1}번째 미션입니다.`} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { HttpResponse, http } from "msw"; | ||
import { API_ENDPOINTS } from "@/apis/endpoints"; | ||
import { serverUrl } from "@/config/serverUrl"; | ||
import alarmcount from "@/mocks/mockResponse/alarmCount.json"; | ||
import alarmCount from "@/mocks/mockResponse/alarmCount.json"; | ||
import alarmInfos from "@/mocks/mockResponse/alarmInfos.json"; | ||
|
||
const alarmHandler = [ | ||
http.get(serverUrl + API_ENDPOINTS.ALARM_COUNT, () => { | ||
return HttpResponse.json(alarmcount, { status: 200 }); | ||
return HttpResponse.json(alarmCount, { status: 200 }); | ||
}), | ||
http.get(serverUrl + API_ENDPOINTS.ALARM_LIST, () => { | ||
return HttpResponse.json(alarmInfos, { status: 200 }); | ||
}), | ||
http.post(serverUrl + API_ENDPOINTS.ALARM_CHECKED, () => { | ||
return HttpResponse.json({ alarmId: 1, alarmType: "USER" }, { status: 200 }); | ||
}), | ||
]; | ||
|
||
export default alarmHandler; |
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.
이것도 타입정리를 한번 해야겠다 생각했었는데, 말 안해도 딱 잘 해주셔서 감사합니다~
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.
useSelectedFeedbackData에 있던 타입이라 바로 분리했습니다ㅎㅎㅎ 감사합니다😊