Input.js
707 Bytes
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
import React from "react";
import styled from "styled-components";
import PropTypes from "prop-types";
const Container = styled.input`
border: 0;
border-radius: 10px;
font-size: 15px;
padding: 10px 10px;
opacity: 0.8;
text-align: center;
`;
const Input = ({
placeholder,
required = true,
value,
onChange,
type = "text",
}) => (
<Container
placeholder={placeholder}
required={required}
value={value}
onChange={onChange}
type={type}
/>
);
Input.propTypes = {
placeholder: PropTypes.string.isRequired,
required: PropTypes.bool,
value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
type: PropTypes.string,
};
export default Input;