removed old components

master
Tudor Stanciu 2020-05-14 23:04:18 +03:00
parent 9840a61071
commit 39b002327f
2 changed files with 0 additions and 86 deletions

View File

@ -1,49 +0,0 @@
import React from "react";
import PropTypes from "prop-types";
const SelectInput = ({
name,
label,
onChange,
defaultOption,
value,
error,
options
}) => {
return (
<div className="form-group">
<label htmlFor={name}>{label}</label>
<div className="field">
{/* Note, value is set here rather than on the option - docs: https://facebook.github.io/react/docs/forms.html */}
<select
name={name}
value={value}
onChange={onChange}
className="form-control"
>
<option value="">{defaultOption}</option>
{options.map((option) => {
return (
<option key={option.value} value={option.value}>
{option.text}
</option>
);
})}
</select>
{error && <div className="alert alert-danger">{error}</div>}
</div>
</div>
);
};
SelectInput.propTypes = {
name: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
defaultOption: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
error: PropTypes.string,
options: PropTypes.arrayOf(PropTypes.object)
};
export default SelectInput;

View File

@ -1,37 +0,0 @@
import React from "react";
import PropTypes from "prop-types";
const TextInput = ({ name, label, onChange, placeholder, value, error }) => {
let wrapperClass = "form-group";
if (error && error.length > 0) {
wrapperClass += " " + "has-error";
}
return (
<div className={wrapperClass}>
<label htmlFor={name}>{label}</label>
<div className="field">
<input
type="text"
name={name}
className="form-control"
placeholder={placeholder}
value={value}
onChange={onChange}
/>
{error && <div className="alert alert-danger">{error}</div>}
</div>
</div>
);
};
TextInput.propTypes = {
name: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
placeholder: PropTypes.string,
value: PropTypes.string,
error: PropTypes.string
};
export default TextInput;