Skip to content

Commit 90cfaf5

Browse files
committed
design: 드롭다운 컴포넌트 마크업
1 parent ae6bc47 commit 90cfaf5

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/components/commons/DropDown.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from 'react'
2+
import styled from 'styled-components'
3+
import { mediumWeight } from '../../style/font'
4+
import { xsmallRadius } from '../../style/border'
5+
6+
const SelectWrapper = styled.select`
7+
width: 7rem;
8+
padding: 3px 0 3px 3px;
9+
font-weight: ${mediumWeight};
10+
color: black;
11+
border-radius: ${xsmallRadius};
12+
`
13+
14+
function DropDown({
15+
selectName,
16+
selectId,
17+
options,
18+
labelText = undefined,
19+
}: {
20+
selectName: string
21+
selectId: string
22+
options: { name: string; value: string }[]
23+
labelText?: string | undefined
24+
}) {
25+
return (
26+
<>
27+
{labelText && <label htmlFor={selectId}>{labelText}</label>}
28+
29+
<SelectWrapper name={selectName} id={selectId}>
30+
{options.map((option) => {
31+
return (
32+
<option key={option.value} value={option.value}>
33+
{option.value}
34+
</option>
35+
)
36+
})}
37+
</SelectWrapper>
38+
</>
39+
)
40+
}
41+
42+
export default DropDown

0 commit comments

Comments
 (0)