forked from codesquad-members-2023/issue-tracker-max
-
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.
Browse files
Browse the repository at this point in the history
…crud [FE] 레이블, 마일스톤 CRUD 및 이슈 코멘트 삭제 기능 구현
- Loading branch information
Showing
29 changed files
with
1,873 additions
and
154 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MutableRefObject, useEffect, useRef, useState } from 'react'; | ||
|
||
type LabelDropdownReturnType = [ | ||
boolean, | ||
MutableRefObject<HTMLDivElement | null>, | ||
() => void, | ||
]; | ||
|
||
export default function useDropdown( | ||
initialState: boolean | ||
): LabelDropdownReturnType { | ||
const [isOpen, setIsOpen] = useState(initialState); | ||
const ref = useRef<HTMLDivElement | null>(null); | ||
|
||
const onSetOpenState = () => { | ||
setIsOpen((prev) => !prev); | ||
}; | ||
|
||
useEffect(() => { | ||
const onClick = (e: MouseEvent) => { | ||
if (ref.current !== null && !ref.current.contains(e.target as Node)) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
|
||
if (isOpen) { | ||
window.addEventListener('click', onClick); | ||
} | ||
|
||
return () => { | ||
window.removeEventListener('click', onClick); | ||
}; | ||
}, [isOpen]); | ||
|
||
return [isOpen, ref, onSetOpenState]; | ||
} |
File renamed without changes.
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,59 @@ | ||
import { | ||
Dispatch, | ||
ReactNode, | ||
SetStateAction, | ||
createContext, | ||
useState, | ||
} from 'react'; | ||
|
||
type LabelProviderProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export const LabelContext = createContext<{ | ||
title: string; | ||
description: string; | ||
backgroundColor: string; | ||
textColor: string; | ||
setTitle: Dispatch<SetStateAction<string>>; | ||
setDescription: Dispatch<SetStateAction<string>>; | ||
setBackgroundColor: Dispatch<SetStateAction<string>>; | ||
onSelectTextColor: (color: string) => void; | ||
} | null>(null); | ||
|
||
export function LabelProvider({ children }: LabelProviderProps) { | ||
const [title, setTitle] = useState(''); | ||
const [textColor, setTextColor] = useState('white'); | ||
const [backgroundColor, setBackgroundColor] = useState('#000000'); | ||
const [description, setDescription] = useState(''); | ||
|
||
const onSelectTextColor = (color: string) => { | ||
switch (color) { | ||
case 'white': | ||
setTextColor('white'); | ||
break; | ||
case 'black': | ||
setTextColor('black'); | ||
break; | ||
default: | ||
break; | ||
} | ||
}; | ||
|
||
return ( | ||
<LabelContext.Provider | ||
value={{ | ||
title, | ||
description, | ||
backgroundColor, | ||
textColor, | ||
setTitle, | ||
setDescription, | ||
setBackgroundColor, | ||
onSelectTextColor, | ||
}} | ||
> | ||
{children} | ||
</LabelContext.Provider> | ||
); | ||
} |
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,9 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
export default function Footer() { | ||
return <footer css={footer} />; | ||
} | ||
|
||
const footer = css` | ||
height: 94px; | ||
`; |
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
Oops, something went wrong.