-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor: 커피챗 오픈/수정 페이지 변경사항 적용 #1702
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b8522c7
feat: 경력 선택 항목 UI 변경
pepperdad 03d89cc
feat: MO에서 사용 가능한 BottomSheetSelect 컴포넌트 추가
pepperdad e51c98d
feat: 경력 선택 항목 UI 변경
pepperdad 969b128
feat: 커피챗 진행 방식 UI 변경
pepperdad c6ca0ca
fix: 자기소개 항목) 필수 -> 선택항목으로 변경
pepperdad 369862c
refactor: MO: 관련 분야, 커피챗 주제 및 소개 섹션 chip md->sm으로 사이즈 변경
pepperdad f940635
chore: 커피챗 주제 및 소개 항목) placeholder 변경
pepperdad 9857886
chore: 경력 선택 항목 dropdown 사이즈 변경
pepperdad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
149 changes: 149 additions & 0 deletions
149
src/components/coffeechat/upload/CoffeechatForm/BottomSheetSelect/index.tsx
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,149 @@ | ||
import styled from '@emotion/styled'; | ||
import { colors } from '@sopt-makers/colors'; | ||
import { fonts } from '@sopt-makers/fonts'; | ||
import { IconCheck, IconChevronDown } from '@sopt-makers/icons'; | ||
import { Button } from '@sopt-makers/ui'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { zIndex } from '@/styles/zIndex'; | ||
|
||
interface Option { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
interface BottomSheetSelectProps { | ||
options: Option[]; | ||
value: string | string[] | null | undefined; | ||
placeholder: string; | ||
onChange: (value: string) => void; | ||
} | ||
const BottomSheetSelect = ({ options, value, placeholder, onChange }: BottomSheetSelectProps) => { | ||
const [open, setOpen] = useState(false); | ||
const [selectedValue, setSelectedValue] = useState(value); | ||
const [temporaryValue, setTemporaryValue] = useState(value); | ||
|
||
const handleOpen = () => setOpen(true); | ||
const handleClose = () => setOpen(false); | ||
|
||
const handleOptionSelect = (value: string) => { | ||
setTemporaryValue(value); | ||
}; | ||
|
||
const handleConfirm = () => { | ||
setSelectedValue(temporaryValue); | ||
if (temporaryValue !== '') onChange(temporaryValue as string); | ||
|
||
handleClose(); | ||
}; | ||
|
||
useEffect(() => { | ||
if (open) { | ||
document.body.style.overflow = 'hidden'; | ||
} else { | ||
document.body.style.overflow = ''; | ||
} | ||
|
||
return () => { | ||
document.body.style.overflow = ''; | ||
}; | ||
}, [open]); | ||
|
||
return ( | ||
<Container> | ||
<InputField onClick={handleOpen}> | ||
{selectedValue !== null ? <p>{selectedValue}</p> : <p style={{ color: '#808087' }}>{placeholder}</p>} | ||
<IconChevronDown | ||
style={{ | ||
width: 20, | ||
height: 20, | ||
transform: open ? 'rotate(-180deg)' : '', | ||
transition: 'all 0.5s', | ||
}} | ||
/> | ||
</InputField> | ||
|
||
{open && ( | ||
<> | ||
<Overlay onClick={handleClose} /> | ||
<BottomSheet> | ||
<OptionList> | ||
{options.map((option) => ( | ||
<OptionItem key={option.value} onClick={() => handleOptionSelect(option.value)}> | ||
{option.label} | ||
{temporaryValue === option.value && <CheckedIcon />} | ||
</OptionItem> | ||
))} | ||
</OptionList> | ||
<Button size='lg' style={{ width: '100%' }} onClick={handleConfirm}> | ||
확인 | ||
</Button> | ||
</BottomSheet> | ||
</> | ||
)} | ||
</Container> | ||
); | ||
}; | ||
export default BottomSheetSelect; | ||
|
||
const Container = styled.div` | ||
position: relative; | ||
width: 100%; | ||
`; | ||
|
||
const InputField = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-radius: 10px; | ||
background-color: ${colors.gray800}; | ||
cursor: pointer; | ||
padding: 11px 16px; | ||
${fonts.BODY_16_M}; | ||
`; | ||
|
||
const Overlay = styled.div` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
z-index: ${zIndex.헤더}; | ||
background-color: rgb(15 15 18 / 80%); | ||
width: 100%; | ||
height: 100%; | ||
`; | ||
|
||
const BottomSheet = styled.section` | ||
position: fixed; | ||
bottom: 0; | ||
z-index: ${zIndex.헤더}; | ||
margin-bottom: 12px; | ||
border-radius: 16px; | ||
background-color: ${colors.gray800}; | ||
padding: 16px; | ||
width: calc(100% - 40px); | ||
`; | ||
|
||
const OptionList = styled.ul` | ||
margin: 0 0 16px; | ||
padding: 0; | ||
max-height: 300px; | ||
overflow-y: auto; | ||
list-style: none; | ||
`; | ||
|
||
const OptionItem = styled.li` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
padding: 10px; | ||
height: 44px; | ||
${fonts.BODY_14_M} | ||
`; | ||
|
||
const CheckedIcon = styled(IconCheck)` | ||
width: 24px; | ||
height: 24px; | ||
color: ${colors.success}; | ||
`; |
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
15 changes: 8 additions & 7 deletions
15
src/components/coffeechat/upload/CoffeechatForm/constants.ts
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
q
요기 돔을 직접 조작하는 코드같은데, 이렇게 사용한 이유가 있는지 궁금해요!
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.
a
요기는 BottomSheet가 열리면 뒤 배경이 스크롤되지 않도록 추가해줬습니다!