-
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.
Merge branch 'develop' of https://github.com/prgrms-web-devcourse-fin…
…al-project/WEB1_1_DDang_FE into 43-design-소셜-디자인
- Loading branch information
Showing
29 changed files
with
1,174 additions
and
89 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,48 @@ | ||
import { useState } from 'react' | ||
import * as S from './styles' | ||
|
||
interface Option { | ||
value: string | ||
label: string | ||
} | ||
|
||
interface SelectProps { | ||
options: Option[] | ||
value: string | ||
onChange: (value: string) => void | ||
placeholder?: string | ||
} | ||
|
||
const Select = ({ options, value, onChange, placeholder }: SelectProps) => { | ||
const [isOpen, setIsOpen] = useState(false) | ||
|
||
const selectedOption = options.find(option => option.value === value) | ||
|
||
return ( | ||
<S.SelectContainer> | ||
<S.SelectButton onClick={() => setIsOpen(!isOpen)}> | ||
{selectedOption ? selectedOption.label : placeholder || '선택하세요'} | ||
<S.Arrow isOpen={isOpen} /> | ||
</S.SelectButton> | ||
|
||
{isOpen && ( | ||
<S.OptionList> | ||
{options.map(option => ( | ||
<S.Option | ||
key={option.value} | ||
onClick={() => { | ||
onChange(option.value) | ||
setIsOpen(false) | ||
}} | ||
isSelected={value === option.value} | ||
> | ||
{option.label} | ||
</S.Option> | ||
))} | ||
</S.OptionList> | ||
)} | ||
</S.SelectContainer> | ||
) | ||
} | ||
|
||
export default Select |
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,65 @@ | ||
import styled, { css } from 'styled-components' | ||
|
||
export const SelectContainer = styled.div` | ||
position: relative; | ||
width: 100%; | ||
margin-bottom: 33px; | ||
` | ||
|
||
export const SelectButton = styled.button` | ||
width: 100%; | ||
padding: 12px 16px; | ||
background: white; | ||
border: 1px solid ${({ theme }) => theme.colors.grayscale.gc_3}; | ||
border-radius: 8px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
cursor: pointer; | ||
font-size: 14px; | ||
color: ${({ theme }) => theme.colors.grayscale.font_1}; | ||
height: 54px; | ||
` | ||
|
||
export const Arrow = styled.span<{ isOpen: boolean }>` | ||
width: 0; | ||
height: 0; | ||
border-left: 5px solid transparent; | ||
border-right: 5px solid transparent; | ||
border-top: 5px solid ${({ theme }) => theme.colors.grayscale.font_2}; | ||
transform: ${({ isOpen }) => (isOpen ? 'rotate(180deg)' : 'rotate(0deg)')}; | ||
transition: transform 0.2s ease; | ||
` | ||
|
||
export const OptionList = styled.ul` | ||
position: absolute; | ||
top: 100%; | ||
left: 0; | ||
right: 0; | ||
margin-top: 4px; | ||
padding: 0; | ||
background: white; | ||
border: 1px solid ${({ theme }) => theme.colors.grayscale.gc_1}; | ||
border-radius: 8px; | ||
list-style: none; | ||
max-height: 200px; | ||
overflow-y: auto; | ||
z-index: 1000; | ||
` | ||
|
||
export const Option = styled.li<{ isSelected: boolean }>` | ||
padding: 12px 16px; | ||
cursor: pointer; | ||
font-size: 14px; | ||
${({ isSelected, theme }) => | ||
isSelected && | ||
css` | ||
background-color: ${theme.colors.brand.lighten_3}; | ||
color: ${theme.colors.brand.default}; | ||
`} | ||
&:hover { | ||
background-color: ${({ theme }) => theme.colors.grayscale.gc_3}; | ||
} | ||
` |
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,119 @@ | ||
{ | ||
"breeds": [ | ||
"래브라도 리트리버", | ||
"골든 리트리버", | ||
"저먼 셰퍼드", | ||
"도베르만", | ||
"그레이트 데인", | ||
"버니즈 마운틴 독", | ||
"뉴펀들랜드", | ||
"로트와일러", | ||
"세인트 버나드", | ||
"아이리시 울프하운드", | ||
"잉글리시 마스티프", | ||
"그레이트 피레니즈", | ||
"시베리안 허스키", | ||
"알래스칸 맬러뮤트", | ||
"보더 콜리", | ||
"비글", | ||
"불독", | ||
"차우차우", | ||
"달마시안", | ||
"사모예드", | ||
"시바견", | ||
"웰시코기", | ||
"진도견", | ||
"아키타", | ||
"바셋하운드", | ||
"브리타니", | ||
"콜리", | ||
"잉글리시 세터", | ||
"잉글리시 스프링거 스패니얼", | ||
"벨기에 말리노이즈", | ||
"포인터", | ||
"에어데일 테리어", | ||
"휘펫", | ||
"불 테리어", | ||
"스탠더드 푸들", | ||
"아메리칸 에스키모", | ||
"보더 테리어", | ||
"웨스트하이랜드 화이트 테리어", | ||
"프렌치 불독", | ||
"포메라니안", | ||
"치와와", | ||
"요크셔테리어", | ||
"미니어처 슈나우저", | ||
"미니어처 푸들", | ||
"토이 푸들", | ||
"말티즈", | ||
"시츄", | ||
"닥스훈트", | ||
"비숑 프리제", | ||
"파피용", | ||
"퍼그", | ||
"페키니즈", | ||
"잭 러셀 테리어", | ||
"미니어처 핀셔", | ||
"캐벌리어 킹 찰스 스패니얼", | ||
"보스턴 테리어", | ||
"이탈리안 그레이하운드", | ||
"스코티시 테리어", | ||
"실키 테리어", | ||
"케언 테리어", | ||
"노리치 테리어", | ||
"아프간 하운드", | ||
"살루키", | ||
"바센지", | ||
"차이니즈 샤페이", | ||
"아메리칸 코카 스패니얼", | ||
"잉글리시 코카 스패니얼", | ||
"클럼버 스패니얼", | ||
"필드 스패니얼", | ||
"저먼 와이어헤어드 포인터", | ||
"체서피크 베이 리트리버", | ||
"컬리코티드 리트리버", | ||
"플랫코티드 리트리버", | ||
"아이리시 세터", | ||
"고든 세터", | ||
"올드 잉글리시 시프도그", | ||
"셔틀랜드 시프도그", | ||
"벨기안 시프도그", | ||
"오스트레일리안 캐틀 독", | ||
"핀란드 스피츠", | ||
"케이스혼드", | ||
"티베탄 마스티프", | ||
"불마스티프", | ||
"네아폴리탄 마스티프", | ||
"블러드하운드", | ||
"그레이하운드", | ||
"노르웨이언 엘크하운드", | ||
"아이리시 워터 스패니얼", | ||
"웨일즈 스프링거 스패니얼", | ||
"스탠더드 슈나우저", | ||
"자이언트 슈나우저", | ||
"스코티시 디어하운드", | ||
"맨체스터 테리어", | ||
"노퍽 테리어", | ||
"래빗 닥스훈트", | ||
"롱헤어드 닥스훈트", | ||
"아메리칸 불리", | ||
"버니두들", | ||
"골든두들", | ||
"래브라두들", | ||
"포르투갈 워터 독", | ||
"오스트레일리안 셰퍼드", | ||
"벨기에 터뷰런", | ||
"블랙 러시안 테리어", | ||
"불 마스티프", | ||
"체서피크 베이 리트리버", | ||
"샤페이", | ||
"클럼버 스패니얼", | ||
"컬리 코티드 리트리버", | ||
"댄디 딘몬트 테리어", | ||
"잉글리시 폭스하운드", | ||
"필드 스패니얼", | ||
"핀란드 라프훈드", | ||
"자이언트 슈나우저", | ||
"아이비전 하운드" | ||
] | ||
} |
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
Oops, something went wrong.