-
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.
- Loading branch information
1 parent
5bf6e02
commit e177068
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import styled from 'styled-components' | ||
|
||
const InputBase = styled.input` | ||
width: 100%; | ||
padding: 15px; | ||
font-size: 14px; | ||
border: 1px solid ${({ theme }) => theme.colors.primary}; | ||
color: ${({ theme }) => theme.colors.contrastText}; | ||
background-color: ${({ theme }) => theme.colors.mainBg}; | ||
border-radius: ${({ theme }) => theme.borderRadius}; | ||
outline: 0; | ||
margin-bottom: 5px; | ||
` | ||
|
||
export default function Input({ onChange, placeholder, ...props }) { | ||
return ( | ||
<div> | ||
<InputBase | ||
placeholder={placeholder} | ||
onChange={onChange} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
Input.defaultProps = { | ||
value: '', | ||
} | ||
|
||
Input.propTypes = { | ||
onChange: PropTypes.func.isRequired, | ||
placeholder: PropTypes.string.isRequired, | ||
name: PropTypes.string.isRequired, | ||
value: PropTypes.string, | ||
} |