Skip to content

Commit

Permalink
fix: 이벤트 위임 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Leeseunghwan7305 committed Dec 13, 2023
1 parent 6218019 commit eb17450
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/auctionPage/Board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const Board = ({
const { city, province } = creator;

return (
<div className={styles.board}>
<div id="board" data-id={id} className={styles.board}>
<div className={styles.userImage}>
<Image data-id={id} src={imageUrl} alt="picture" fill />
<Image src={imageUrl} alt="picture" fill />
</div>
<div data-id={id} className={styles.userInfo}>
<div className={styles.userInfo}>
<div className={styles.profile}>
<Image src={profile} alt="profile" fill />
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/components/auctionPage/BoardList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ const BoardList = ({ Boards }: Props) => {

const gotoDetailBoard = (e: React.MouseEvent<HTMLDivElement>) => {
const target = e.target as HTMLDivElement;
const boardId = target.dataset.id;
router.push(`/auction/${boardId}`);
if (target.closest('#board')) {
const parentChild = target.closest('#board');
const id = parentChild?.getAttribute('data-id');
router.push(`/auction/${id}`);
}
};

return (
<div
onClick={gotoDetailBoard}
Expand Down

0 comments on commit eb17450

Please sign in to comment.