-
Notifications
You must be signed in to change notification settings - Fork 0
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(#7): update mypage
- Loading branch information
Showing
15 changed files
with
2,189 additions
and
8 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { MdKeyboardArrowDown } from "react-icons/md"; | ||
|
||
const SelectContainer = styled.div` | ||
position: relative; | ||
width: 100%; | ||
`; | ||
|
||
const StyledSelect = styled.select` | ||
width: 100%; | ||
padding: 13px 30px 13px 13px; | ||
border: 1px solid #E4E4E4; | ||
border-radius: 5px; | ||
font-size: 11px; | ||
appearance: none; | ||
margin-bottom: 8px; | ||
background-color: white; | ||
cursor: pointer; | ||
&:focus { | ||
border-color: #E4E4E4; | ||
outline: none; | ||
} | ||
`; | ||
|
||
const ArrowIcon = styled(MdKeyboardArrowDown)` | ||
position: absolute; | ||
right: 10px; | ||
top: 40%; | ||
transform: translateY(-50%); | ||
pointer-events: none; | ||
`; | ||
|
||
const SelectBox = ({ options, value, onChange, placeholder, required }) => { | ||
return ( | ||
<SelectContainer> | ||
<StyledSelect value={value || ""} onChange={onChange} required={required}> | ||
<option value="" disabled> | ||
{placeholder} | ||
</option> | ||
{options.map((option) => ( | ||
<option key={option.value} value={option.value}> | ||
{option.label} | ||
</option> | ||
))} | ||
</StyledSelect> | ||
<ArrowIcon /> | ||
</SelectContainer> | ||
); | ||
}; | ||
|
||
export default SelectBox; |
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,80 @@ | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
margin-bottom: 10px; | ||
`; | ||
|
||
const InputFile = styled.label` | ||
display: inline-block; | ||
padding: 10px 20px; | ||
background-color: #FFEFEF; | ||
align-items: center; | ||
color: #FF6E00; | ||
border-radius: 20px; | ||
cursor: pointer; | ||
font-size: 10px; | ||
font-weight: bold; | ||
transition: background-color 0.3s; | ||
margin-top : -15px; | ||
&:hover { | ||
background-color: #FFD3D3; | ||
} | ||
`; | ||
|
||
const HiddenInput = styled.input` | ||
display: none; | ||
`; | ||
|
||
const ImageBox = styled.div` | ||
margin-top: 10px; | ||
padding: 4px; | ||
display: flex; | ||
justify-content: center; | ||
`; | ||
|
||
const UploadImg = ({ imgPath, setImgPath }) => { | ||
|
||
const addImage = (e) => { | ||
const files = e.target.files; | ||
if (files.length > 0) { | ||
const newPath = [URL.createObjectURL(files[0])]; | ||
setImgPath(newPath); | ||
} | ||
}; | ||
|
||
return ( | ||
<Container> | ||
<ImageBox> | ||
{imgPath.length > 0 && ( | ||
<img | ||
src={imgPath[0]} | ||
alt='애완동물 사진' | ||
style={{ | ||
width: '150px', | ||
height: '150px', | ||
borderRadius: '50%', | ||
objectFit: 'cover' | ||
}} | ||
/> | ||
)} | ||
</ImageBox> | ||
<InputFile htmlFor="inputForm"> | ||
등록 | ||
<HiddenInput | ||
className="inputFile" | ||
type="file" | ||
id="inputForm" | ||
onChange={addImage} | ||
/> | ||
</InputFile> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default UploadImg; |
Oops, something went wrong.