forked from CHAI53/wediz-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileUpload.js
54 lines (47 loc) · 1.16 KB
/
FileUpload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React from "react";
import styled from "styled-components";
const FileUpload = ({ ...props }) => {
return (
<Container>
<Input type="file" name="file" onChange={props.onChange} id={props.id} />
<Label
htmlFor={props.id}
imgUrl={props.imgUrl}
width={props.width}
height={props.height}
/>
<Button onClick={props.onClick}>프로필 사진 등록</Button>
</Container>
);
};
export default FileUpload;
const Container = styled.div``;
const Input = styled.input`
width: 100%;
display: none;
`;
const Label = styled.label`
display: inline-block;
width: 100%;
::before {
content: "";
display: inline-block;
background: url(${props => props.imgUrl || ""}) no-repeat scroll center
center / 100% auto rgba(0, 0, 0, 0);
width: ${props => props.width || "20px"}
height: ${props => props.height || "20px"}
margin: 0 auto;
border-radius: 50%;
border: 1px solid #efefef;
cursor: pointer;
}
`;
const Button = styled.button`
border: none;
display: block;
font-size: 13px;
text-decoration: underline;
text-align: center;
margin-top: 30px;
cursor: pointer;
`;