-
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.
Browse files
Browse the repository at this point in the history
[Feat/#10] �프로필 등록 페이지 구현
- Loading branch information
Showing
9 changed files
with
531 additions
and
15 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
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,97 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
interface Option { | ||
value: string; | ||
label: string; | ||
} | ||
|
||
interface DropdownProps { | ||
label: string; | ||
essential: boolean; | ||
options: Option[]; | ||
selectedOption: string; | ||
onChange: (value: string) => void; | ||
placeholder?: string; | ||
} | ||
|
||
const Dropdown: React.FC<DropdownProps> = ({ | ||
label, | ||
essential, | ||
options, | ||
selectedOption, | ||
onChange, | ||
placeholder, | ||
}) => { | ||
const handleSelectChange = (event: React.ChangeEvent<HTMLSelectElement>) => { | ||
onChange(event.target.value); | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<TitleWrapper> | ||
<InputTitle>{label}</InputTitle> | ||
{essential && <EssentialIcon>*</EssentialIcon>} | ||
</TitleWrapper> | ||
<SelectBox value={selectedOption} onChange={handleSelectChange}> | ||
<option value="">{placeholder || "Select an option"}</option> | ||
{options.map((option) => ( | ||
<option key={option.value} value={option.value}> | ||
{option.label} | ||
</option> | ||
))} | ||
</SelectBox> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Dropdown; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
`; | ||
|
||
const TitleWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 5px; | ||
`; | ||
|
||
const SelectBox = styled.select` | ||
width: 100%; | ||
height: 40px; | ||
border-radius: 8px; | ||
border: 1px solid #ced4da; | ||
background: #fff; | ||
padding: 10px; | ||
color: #343a40; | ||
outline: none; | ||
color: #495057; | ||
font-family: Pretendard; | ||
font-size: 12px; | ||
font-weight: 500; | ||
line-height: 12px; /* 100% */ | ||
letter-spacing: -0.1px; | ||
`; | ||
|
||
const InputTitle = styled.label` | ||
color: #343a40; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 22px; | ||
letter-spacing: -0.1px; | ||
`; | ||
|
||
const EssentialIcon = styled.span` | ||
color: #f5535e; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 18px; | ||
letter-spacing: -0.1px; | ||
`; |
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,124 @@ | ||
import React from "react"; | ||
import styled, { css } from "styled-components"; | ||
|
||
interface Option { | ||
value: string; | ||
label: string; | ||
} | ||
|
||
interface RadioGroupProps { | ||
label: string; | ||
options: Option[]; | ||
selectedOption: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
interface LabelProps { | ||
isSelected: boolean; | ||
} | ||
|
||
const RadioGroup: React.FC<RadioGroupProps> = ({ | ||
label, | ||
options, | ||
selectedOption, | ||
onChange, | ||
}) => { | ||
return ( | ||
<Container> | ||
<TitleWrapper> | ||
<InputTitle>{label}</InputTitle> | ||
<EssentialIcon>*</EssentialIcon> | ||
</TitleWrapper> | ||
<RadioGroupContainer> | ||
{options.map((option) => ( | ||
<Label | ||
key={option.value} | ||
isSelected={selectedOption === option.value} | ||
> | ||
<RadioInput | ||
type="radio" | ||
name="radioGroup" | ||
value={option.value} | ||
checked={selectedOption === option.value} | ||
onChange={() => onChange(option.value)} | ||
/> | ||
{option.label} | ||
</Label> | ||
))} | ||
</RadioGroupContainer> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default RadioGroup; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
`; | ||
|
||
const RadioGroupContainer = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
gap: 30px; | ||
`; | ||
|
||
const Label = styled.label<LabelProps>` | ||
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
color: #495057; | ||
font-family: Pretendard; | ||
font-size: 12px; | ||
font-weight: 500; | ||
line-height: 12px; /* 100% */ | ||
letter-spacing: -0.1px; | ||
width: 100%; | ||
height: 40px; | ||
border-radius: 8px; | ||
border: 1px solid #ced4da; | ||
background: #fff; | ||
${({ isSelected }) => | ||
isSelected && | ||
css` | ||
background: #bfd8af; | ||
border-color: #868e96; | ||
color: #495057; | ||
font-weight: 600; | ||
`} | ||
`; | ||
|
||
const RadioInput = styled.input` | ||
margin-right: 8px; | ||
accent-color: #6c757d; | ||
cursor: pointer; | ||
opacity: 0; | ||
`; | ||
|
||
const TitleWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 5px; | ||
`; | ||
|
||
const InputTitle = styled.label` | ||
color: #343a40; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 22px; | ||
letter-spacing: -0.1px; | ||
`; | ||
|
||
export const EssentialIcon = styled.span` | ||
color: #f5535e; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 18px; | ||
letter-spacing: -0.1px; | ||
`; |
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,45 @@ | ||
// Textarea.tsx | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
|
||
interface TextareaProps { | ||
value: string; | ||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void; | ||
} | ||
|
||
const Textarea: React.FC<TextareaProps> = ({ value, onChange }) => { | ||
return ( | ||
<Container> | ||
<Title>개발 언어 / 스택</Title> | ||
<TextArea value={value} onChange={onChange} /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Textarea; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
`; | ||
|
||
const Title = styled.label` | ||
color: #343a40; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 22px; | ||
letter-spacing: -0.1px; | ||
`; | ||
|
||
const TextArea = styled.textarea` | ||
width: 100%; | ||
height: 120px; | ||
border-radius: 8px; | ||
border: 1px solid #ced4da; | ||
background: #fff; | ||
padding: 10px; | ||
resize: none; | ||
outline: none; | ||
`; |
Oops, something went wrong.