-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/refactor/i participated meeting/DEVING-79 내가 참여하고있는 모임 리펙토링 #68
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
Changes from all commits
e11b542
2281c2a
7ab5112
c05a1c0
e36cfeb
87dfd0a
886c37a
e1958ee
01cf60b
c256048
3164ab7
9eba5c7
b466ee2
7a39443
9ebe7f0
a343f34
32c731c
f72d7e7
e10693a
3047fe8
5ae6b66
6b9542d
4546f4a
6aef01e
fb9c041
f4c9334
b6f4df6
d4683f0
fffc3a9
881c983
b2eeb44
838989a
44a536e
af329d3
d9f467d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| 'use client'; | ||
|
|
||
| import { useQuitMeetingMutation } from '@/hooks/mutations/useMyMeetingMutation'; | ||
| import { LogOut } from 'lucide-react'; | ||
|
|
||
| interface LeaveMeetingButtonProps { | ||
| meetingId: number; | ||
| className?: string; | ||
| } | ||
|
|
||
| const LeaveMeetingButton = ({ | ||
| meetingId, | ||
| className = '', | ||
| }: LeaveMeetingButtonProps) => { | ||
| const { mutate: quitMeeting, isPending: isLoading } = | ||
| useQuitMeetingMutation(); | ||
|
|
||
| const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => { | ||
| e.stopPropagation(); | ||
| quitMeeting(meetingId); | ||
| }; | ||
|
|
||
| return ( | ||
| <button | ||
| type="button" | ||
| onClick={handleClick} | ||
| className={`absolute bottom-2 right-2 z-10 flex items-center rounded-md px-3 py-1.5 ${ | ||
| isLoading ? 'opacity-70' : '' | ||
| } ${className}`} | ||
| aria-label="모임 탈퇴하기" | ||
| disabled={isLoading} | ||
| > | ||
|
Comment on lines
+24
to
+32
Contributor
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. className이 여기에만 적용이 되어있는데, 상세 조회에서는 이 컴포넌트 커스텀을 어떻게 하면 될까요? 아이콘이나 글씨 크기 등도 고려가 필요할 것 같습니다.
Contributor
Author
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. 요부분 prop추가하겠슴니다 |
||
| <LogOut | ||
| size={16} | ||
| className={`mr-1.5 ${isLoading ? 'animate-pulse' : ''}`} | ||
| /> | ||
| <span className="typo-button2"> | ||
| {isLoading ? '처리 중...' : '모임 탈퇴하기'} | ||
| </span> | ||
| </button> | ||
| ); | ||
| }; | ||
|
|
||
| export default LeaveMeetingButton; | ||
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을 사용하지 않으시고 isPending을 isLoading으로 바꿔사용하시는 이유가 있으실까요?
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을 사용하고 있더라구요. 어제 문득 isPending과 isLoading중 어떤 거 사용해야할지 좀 고민이 있었다가 TanStack/query#6297 요고보구 v5에선 isPending을 사용한다기에, 통일성을 위해서 일단은 isPending 쓰고 isLoading으로 맞춰넣었슴니다. isLoading으로 일단 통일하겠슴니다
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.
윤지님 해당 부분 리엑트쿼리 v5에서 useMutation의 반환값에서 isLoading이 삭제되고 isPending으로 대체되엇다고합니다. 따라 isPending이 isLoading 대신 사용된다고 합니다. 그래서 기존 코드 보았을 때 isLoading을 사용하는 부분이 인피니티 쿼리와 useQuery부분임니당 해당 부분에서의 isLoading은 첫 페이지 데이터를 로딩 중일때만 true가 되는 상태라고 합니다!