-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
409 additions
and
192 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useEffect } from 'react'; | ||
|
||
function useOnClickOutside<T extends HTMLElement = HTMLElement>( | ||
ref: React.RefObject<T>, | ||
handler: (event?: Event | MouseEvent) => void, | ||
) { | ||
useEffect(() => { | ||
function onClickHandler(event: Event | MouseEvent) { | ||
if (!ref?.current || ref?.current.contains(event?.target as Node)) { | ||
return; | ||
} | ||
handler(event); | ||
} | ||
|
||
function onTouchHandler(event: TouchEvent) { | ||
if (!ref?.current || ref?.current.contains(event?.target as Node)) { | ||
return; | ||
} | ||
handler(event); | ||
} | ||
|
||
window.addEventListener('click', onClickHandler); | ||
window.addEventListener('touchstart', onTouchHandler); | ||
|
||
return () => { | ||
window.removeEventListener('click', onClickHandler); | ||
window.removeEventListener('touchstart', onTouchHandler); | ||
}; | ||
}, [ref, handler]); | ||
} | ||
|
||
export default useOnClickOutside; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ html { | |
button { | ||
border: none; | ||
font-family: Pretandard, sans-serif; | ||
cursor: pointer; | ||
} | ||
|
||
a, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,11 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: #f5f5f5; | ||
height: 100%; | ||
font-family: Pretendard, sans-serif; | ||
} | ||
|
||
.container-wrapper { | ||
.content { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.place { | ||
&__container { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
margin-top: 24px; | ||
margin-left: 24px; | ||
} | ||
|
||
&__button--selected { | ||
width: 60px; | ||
height: 30px; | ||
background-color: #175c8e; | ||
color: #fff; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: 999px; | ||
cursor: pointer; | ||
} | ||
|
||
&__button--unselected { | ||
width: 60px; | ||
height: 30px; | ||
background-color: #fff; | ||
color: #175c8e; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: solid 1px #175c8e; | ||
border-radius: 999px; | ||
cursor: pointer; | ||
} | ||
} | ||
flex-direction: column; | ||
padding: 16px 24px; | ||
gap: 12px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.