-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] 지원자페이지 구현 #1337
The head ref may contain hidden characters: "Feat/1254-\uC9C0\uC6D0\uC790\uD398\uC774\uC9C0-\uAD6C\uD604"
[Feat] 지원자페이지 구현 #1337
Changes from all commits
dc3f969
b006a7f
b908bab
ddfb687
01910d6
cde9fe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React, { useState, useEffect, useCallback } from 'react'; | ||
import { | ||
FormControl, | ||
Select, | ||
OutlinedInput, | ||
MenuItem, | ||
ListItemText, | ||
SelectChangeEvent, | ||
} from '@mui/material'; | ||
import { | ||
IcheckItem, | ||
IrecruitUserTable, | ||
} from 'types/admin/adminRecruitmentsTypes'; | ||
import useRecruitmentUserFilter from 'hooks/recruitments/useRecruitmentUserFilter'; | ||
import styles from 'styles/admin/recruitments/RecruitmentsUser.module.scss'; | ||
import RecruitSearchBar from './RecruitSearchBar'; | ||
|
||
const ITEM_HEIGHT = 48; | ||
const ITEM_PADDING_TOP = 8; | ||
const MenuProps = { | ||
PaperProps: { | ||
style: { | ||
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, | ||
width: 250, | ||
}, | ||
}, | ||
}; | ||
|
||
function FilterQptionsUI(recruitUserData: IrecruitUserTable[]) { | ||
const [answers, setAnswers] = useState<Array<IcheckItem>>([]); | ||
const { checklistIds, handleChecklistChange } = useRecruitmentUserFilter(); | ||
|
||
useEffect(() => { | ||
setAnswers( | ||
recruitUserData.reduce((acc, recruit) => { | ||
recruit.form.forEach((formItem) => { | ||
if (formItem.inputType !== 'TEXT') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. filter로 써도 좋을 것 같아요 |
||
formItem.checkedList?.forEach((item) => { | ||
if (!acc.some((answer) => answer.checkId === item.checkId)) { | ||
acc.push(item); | ||
} | ||
}); | ||
} | ||
}); | ||
return acc; | ||
}, [] as Array<IcheckItem>) | ||
); | ||
}, [recruitUserData]); | ||
|
||
return ( | ||
<div className={styles.filterWrap}> | ||
<div className={styles.searchWrap}> | ||
<RecruitSearchBar /> | ||
</div> | ||
<div className={styles.selectWrap}> | ||
<FormControl sx={{ m: 1, width: 200 }}> | ||
<Select | ||
labelId='demo-multiple-checkbox-label' | ||
id='demo-multiple-checkbox' | ||
Comment on lines
+58
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아이디에 demo 붙어 있는데, 임시로 조치한 부분이 아니면 제거하는 것이 좋을 것 같습니다. |
||
multiple | ||
value={checklistIds} | ||
onChange={handleChecklistChange} | ||
input={<OutlinedInput label='Tag' />} | ||
renderValue={(selected) => selected.join(', ')} | ||
MenuProps={MenuProps} | ||
> | ||
{answers.map((answer: IcheckItem, index) => ( | ||
<MenuItem key={index} value={answer.checkId}> | ||
<ListItemText primary={answer.content} /> | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default FilterQptionsUI; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { GoSearch } from 'react-icons/go'; | ||
import { IoIosCloseCircle } from 'react-icons/io'; | ||
import useRecruitmentUserFilter from 'hooks/recruitments/useRecruitmentUserFilter'; | ||
import useSearchBar from 'hooks/useSearchBar'; | ||
import styles from 'styles/admin/common/AdminSearchBar.module.scss'; | ||
|
||
const MAX_SEARCH_LENGTH = 15; | ||
|
||
export default function RecruitSearchBar() { | ||
const { keyword, setKeyword, searchBarRef } = useSearchBar(); | ||
|
||
const { initSearch } = useRecruitmentUserFilter(); | ||
|
||
const adminhandleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { | ||
if (event.key === 'Enter') { | ||
event.currentTarget.blur(); | ||
initSearch(keyword); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className={styles.adminSearchBar} ref={searchBarRef}> | ||
<input | ||
type='text' | ||
onChange={(e) => { | ||
setKeyword(e.target.value); | ||
}} | ||
onKeyDown={adminhandleKeyDown} | ||
placeholder='검색하기...' | ||
maxLength={MAX_SEARCH_LENGTH} | ||
value={keyword} | ||
/> | ||
<div className={styles.icons}> | ||
{keyword ? ( | ||
<span | ||
className={styles.reset} | ||
onClick={() => { | ||
initSearch(); | ||
setKeyword(''); | ||
}} | ||
> | ||
<IoIosCloseCircle /> | ||
</span> | ||
) : ( | ||
<span | ||
onClick={() => { | ||
initSearch(); | ||
}} | ||
> | ||
<GoSearch /> | ||
</span> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분은 왜 주석인가요?