mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
Add 'react/' from commit 'e508ac031e5d832aa95ad8ef040e82277db804d2'
git-subtree-dir: react git-subtree-mainline:53976e7b43git-subtree-split:e508ac031e
This commit is contained in:
30
react/src/components/user/InputField.js
Normal file
30
react/src/components/user/InputField.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default function InputField({
|
||||
required,
|
||||
input,
|
||||
label,
|
||||
meta: { touched, error },
|
||||
type,
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<label htmlFor={input.name}>
|
||||
{label} <input required={required} {...input} type={type} />
|
||||
</label>
|
||||
{touched && error && <span className="error">{error}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
InputField.propTypes = {
|
||||
required: PropTypes.bool.isRequired,
|
||||
input: PropTypes.any.isRequired,
|
||||
label: PropTypes.string.isRequired,
|
||||
meta: PropTypes.shape({
|
||||
touched: PropTypes.bool,
|
||||
error: PropTypes.string,
|
||||
}).isRequired,
|
||||
type: PropTypes.string.isRequired,
|
||||
};
|
||||
Reference in New Issue
Block a user