-
Notifications
You must be signed in to change notification settings - Fork 0
글 상세 페이지 수정, 삭제 버튼 추가 #30
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
base: master
Are you sure you want to change the base?
Conversation
ssabii
left a comment
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.
고생하셨습니다.
| <IconButton | ||
| aria-label="more" | ||
| id="long-button" | ||
| aria-controls={openDetailMenu ? 'fade-menu' : undefined} | ||
| aria-haspopup="true" | ||
| aria-expanded={openDetailMenu ? 'true' : undefined} | ||
| onClick={handleClick} | ||
| > | ||
| <MoreVertIcon /> | ||
| </IconButton> | ||
| <Menu | ||
| id="fade-menu" | ||
| MenuListProps={{ | ||
| 'aria-labelledby': 'fade-button', | ||
| }} | ||
| anchorEl={anchorEl} | ||
| open={openDetailMenu} | ||
| onClose={handleClose} | ||
| TransitionComponent={Fade} | ||
| > | ||
| <MenuItem onClick={onClickEdit}>수정</MenuItem> | ||
| <MenuItem onClick={onClickDelete}>삭제</MenuItem> | ||
| </Menu> |
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.
mui menu 사용해서 수정/삭제 구현한거 너무 좋네요 😄
컴포넌트가 조금 비대해지는 것 같은데 이 부분은 나중에 역할과 용도에 따라 PostEditMenu 이런식으로 해서 컴포넌트로 분리해도 괜찮을것 같아요.
컴포넌트를 분리하면 나중에 내가 작성한 글이면 권한에 따라 보여질 지 안보여 질지 조건부 렌더링할때도 유용할 것 같아요
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.
그렇겠네요! 좋습니당
| const onClickDelete = () => { | ||
| }; |
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.
eslint 설정으로 빈 함수는 오류가 나게 설정되어 있어서 빌드할 때는 아마 오류가 날 것 같아요.
아래처럼 일단 해주셔도 될 것 같고 삭제 api 연동은 추후에 제가 작업을 할게요!
// eslint-disable-next-line @typescript-eslint/no-empty-function
const onClickDelete = () => {};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.
가독성을 위해 함수 사이에 공백을 추가해도 좋을거 같아요
| const onClickDelete = () => { | |
| }; | |
| const openDetailMenu = Boolean(anchorEl); | |
| const handleClick = (event: React.MouseEvent<HTMLElement>) => { | |
| setAnchorEl(event.currentTarget); | |
| }; | |
| const handleClose = () => { | |
| setAnchorEl(null); | |
| }; | |
| const onClickEdit = () => { | |
| router.push(`/post/edit/${id}`) | |
| }; | |
| const onClickDelete = () => { | |
| }; |
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.
아하! 넵 알겠습니다!!
설명
글 상세 페이지에 수정, 삭제 버튼 추가하였습니다.
추후 권한 처리 작업도 할 예정입니다.
작업 내용
스크린샷
참고
참고할 만한 링크가 있다면 적어주세요.