-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 💡 이슈 resolve #175 ## 🤩 개요 v1.0.5 업데이트 ## 🧑💻 작업 사항 - 작은 UI 이슈 해결 ## 📖 참고 사항 공유할 내용, 레퍼런스, 추가로 발생할 것으로 예상되는 이슈, 스크린샷 등을 넣어 주세요.
- Loading branch information
Showing
21 changed files
with
242 additions
and
150 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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
font-weight: 400; | ||
text-align: right; | ||
word-break: keep-all; | ||
word-wrap: break-word; | ||
} | ||
} | ||
|
||
|
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
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
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
82 changes: 82 additions & 0 deletions
82
src/components/shared/molecules/SelectBox/SelectBox.view.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,82 @@ | ||
import { forwardRef, LegacyRef } from 'react'; | ||
|
||
import { SelectArrow } from '@atoms/icon'; | ||
import Span from '@atoms/Span'; | ||
import classnames from 'classnames'; | ||
|
||
import $ from './style.module.scss'; | ||
|
||
type Props = { | ||
name: string; | ||
isClicked: boolean; | ||
labelName: string; | ||
isGender?: boolean; | ||
width?: string; | ||
height?: string; | ||
fontSize?: number; | ||
fontWeight?: number; | ||
children?: React.ReactNode; | ||
handleMouseDown: ( | ||
e: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>, | ||
) => void; | ||
}; | ||
|
||
function SelectBoxView( | ||
viewProps: Props, | ||
ref: LegacyRef<HTMLButtonElement> | null, | ||
) { | ||
const { name, width, height, fontSize, fontWeight, labelName } = viewProps; | ||
const { isGender, isClicked, handleMouseDown, children } = viewProps; | ||
|
||
return ( | ||
<div | ||
className={classnames($['select-box'], { | ||
[$['select-box-clicked']]: isClicked, | ||
[$['gender-box']]: isGender, | ||
})} | ||
style={{ ...{ width, height } }} | ||
> | ||
<button | ||
id={`${name}-select-box`} | ||
ref={ref} | ||
type="button" | ||
aria-haspopup="true" | ||
aria-expanded="true" | ||
aria-controls={`${name}-select-list`} | ||
onClick={handleMouseDown} | ||
> | ||
<Span | ||
fontSize={fontSize || 16} | ||
fontWeight={fontWeight || 400} | ||
className={classnames($.text, { | ||
[$['gender-text']]: isGender, | ||
})} | ||
> | ||
{labelName || '선택'} | ||
</Span> | ||
<SelectArrow | ||
className={classnames($.arrow, { | ||
[$['arrow-clicked']]: isClicked, | ||
})} | ||
/> | ||
</button> | ||
|
||
{isClicked && ( | ||
<ul | ||
id={`${name}-select-list`} | ||
aria-labelledby={`${name}-select-box`} | ||
role="menu" | ||
tabIndex={0} | ||
style={{ top: height ? `calc(${height} + 6px)` : '56px' }} | ||
className={classnames($['select-wrapper'], { | ||
[$['select-wrapper-clicked']]: isClicked, | ||
})} | ||
> | ||
{children} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default forwardRef(SelectBoxView); |
41 changes: 41 additions & 0 deletions
41
src/components/shared/molecules/SelectBox/SelectMenu.view.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,41 @@ | ||
import { Check } from '@atoms/icon'; | ||
import classnames from 'classnames'; | ||
|
||
import $ from './style.module.scss'; | ||
|
||
type Props = { | ||
isGender?: boolean; | ||
isItemSelected: boolean; | ||
isGenderItemSelected?: boolean; | ||
optionName: string; | ||
height?: string; | ||
fontSize?: string; | ||
handleSelectMenu: () => void; | ||
}; | ||
|
||
function SelectMenuView(viewProps: Props) { | ||
const { height, fontSize, isGender, isGenderItemSelected } = viewProps; | ||
const { isItemSelected, optionName, handleSelectMenu } = viewProps; | ||
|
||
return ( | ||
<li | ||
tabIndex={0} | ||
role="menuitem" | ||
style={{ ...{ height } }} | ||
className={classnames($['select-item'], { | ||
[$['select-item-gender']]: isGender, | ||
[$['select-item-clicked']]: isItemSelected, | ||
[$['select-hover']]: !isGender, | ||
[$['gender-item-clicked']]: isGenderItemSelected, | ||
[$['gender-hover']]: isGender, | ||
})} | ||
onClick={handleSelectMenu} | ||
onKeyPress={handleSelectMenu} | ||
> | ||
<span style={{ fontSize }}>{optionName}</span> | ||
|
||
{isGenderItemSelected && <Check className={$['check-icon']} />} | ||
</li> | ||
); | ||
} | ||
export default SelectMenuView; |
Oops, something went wrong.