mirror of
https://github.com/rjNemo/React-SaaS-sample
synced 2026-06-06 05:06:38 +00:00
33 lines
844 B
JavaScript
33 lines
844 B
JavaScript
import React from "react";
|
|
|
|
function FormField(props) {
|
|
return (
|
|
<div className="field">
|
|
<div className="control">
|
|
{props.type === "textarea" && (
|
|
<textarea
|
|
className="textarea is-medium"
|
|
type={props.type}
|
|
value={props.value}
|
|
placeholder={props.placeholder}
|
|
onChange={e => props.onChange(e.target.value)}
|
|
/>
|
|
)}
|
|
|
|
{props.type !== "textarea" && (
|
|
<input
|
|
className="input is-medium"
|
|
type={props.type}
|
|
value={props.value}
|
|
placeholder={props.placeholder}
|
|
onChange={e => props.onChange(e.target.value)}
|
|
/>
|
|
)}
|
|
</div>
|
|
|
|
{props.error && <p className="help is-danger">{props.error.message}</p>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default FormField;
|