sdy

Create Input.js

1 +import React from "react";
2 +import styled from "styled-components";
3 +import PropTypes from "prop-types";
4 +
5 +const Container = styled.input`
6 + border: 0;
7 + border-radius: 10px;
8 + font-size: 15px;
9 + padding: 10px 10px;
10 + opacity: 0.8;
11 + text-align: center;
12 +`;
13 +
14 +const Input = ({
15 + placeholder,
16 + required = true,
17 + value,
18 + onChange,
19 + type = "text",
20 +}) => (
21 + <Container
22 + placeholder={placeholder}
23 + required={required}
24 + value={value}
25 + onChange={onChange}
26 + type={type}
27 + />
28 +);
29 +
30 +Input.propTypes = {
31 + placeholder: PropTypes.string.isRequired,
32 + required: PropTypes.bool,
33 + value: PropTypes.string.isRequired,
34 + onChange: PropTypes.func.isRequired,
35 + type: PropTypes.string,
36 +};
37 +
38 +export default Input;