Skip to content

Commit

Permalink
Merge pull request #53 from ehdrhelr/fe/refactor
Browse files Browse the repository at this point in the history
[FE]라우터 link reload 오류 해결
  • Loading branch information
hayoung123 authored Jun 3, 2021
2 parents 27b4a99 + b40717c commit 9db5578
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 1 addition & 5 deletions FE/airbnb/src/components/header/form/FormGuest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ const FormGuest = () => {
resetGuests();
};

const handleSubmitClick = (e: MouseEvent): void => {
e.stopPropagation();
};

const linkCondition =
Object.values(reserveInfo as reserveInfoType).filter((v) => !v).length === 0;
const linkURL = clientReserveAPI(reserveInfo as reserveInfoType);
Expand All @@ -62,7 +58,7 @@ const FormGuest = () => {
<FormColumn title='인원' description={getGuestDesc()} />
{isShowDeleteBtn && <DeleteBtn onClick={resetClickHandler} />}
<ConditionalLink to={linkURL} condition={linkCondition}>
<div className='search-icon' onClick={handleSubmitClick}>
<div className='search-icon'>
<IoSearch />
{isFormOpened && <div className='search'>검색</div>}
</div>
Expand Down
8 changes: 8 additions & 0 deletions FE/airbnb/src/hooks/useToggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const useToggle = ({ clickRef, toggleRef, isChekcInSelected }: refsType): toggle

if (clickRef instanceof Array) {
for (const elem of clickRef) {
if (!elem.current) {
setOpen(false);
return;
}
if (
(elem.current as HTMLDivElement).contains(target as HTMLDivElement) &&
selectType === elem.current?.dataset.type
Expand All @@ -47,6 +51,10 @@ const useToggle = ({ clickRef, toggleRef, isChekcInSelected }: refsType): toggle
}
}
} else {
if (!clickRef.current) {
setOpen(false);
return;
}
if ((clickRef.current as HTMLDivElement).contains(target as HTMLDivElement)) {
setOpen((open) => !open);
return;
Expand Down

0 comments on commit 9db5578

Please sign in to comment.