-
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.
스토리 에픽, 타이틀, 포인트, 상태 수정 API 연결 스토리 삭제 API 연결 스토리 블록의 크기가 커서 리팩토링 필요
- Loading branch information
Showing
7 changed files
with
277 additions
and
15 deletions.
There are no files selected for viewing
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
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
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,4 @@ | ||
export const MOUSE_KEY = { | ||
LEFT: 0, | ||
RIGHT: 2, | ||
}; |
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,40 @@ | ||
import { useEffect, useRef, useState } from "react"; | ||
|
||
const useBacklogInputChange = (update: <T>(data: T) => void) => { | ||
const [updating, setUpdating] = useState<boolean>(false); | ||
const inputContainerRef = useRef<HTMLDivElement | null>(null); | ||
const inputElementRef = useRef<HTMLInputElement | null>(null); | ||
|
||
const handleUpdating = (updating: boolean) => { | ||
setUpdating(updating); | ||
}; | ||
|
||
const handleOutsideClick = ({ target }: MouseEvent) => { | ||
if ( | ||
inputContainerRef.current && | ||
!inputContainerRef.current.contains(target as Node) | ||
) { | ||
if (!updating) { | ||
return; | ||
} | ||
|
||
if (inputElementRef.current) { | ||
update(inputElementRef.current.value); | ||
} | ||
|
||
setUpdating(false); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
window.addEventListener("mouseup", handleOutsideClick); | ||
|
||
return () => { | ||
window.removeEventListener("mouseup", handleOutsideClick); | ||
}; | ||
}, [updating]); | ||
|
||
return { updating, inputContainerRef, inputElementRef, handleUpdating }; | ||
}; | ||
|
||
export default useBacklogInputChange; |
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
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
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