mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
33 lines
937 B
JavaScript
33 lines
937 B
JavaScript
import React from 'react';
|
|
|
|
const FormField = (props) => {
|
|
return (
|
|
<span>
|
|
<label htmlFor={props.field}>{props.title}:</label>
|
|
<input
|
|
type={props.type || "text"}
|
|
id={props.field}
|
|
style={props.style}
|
|
className={(props.accountInfo[props.field] && props.errorFieldNames.includes(props.field)) ? 'error' : ''}
|
|
disabled={props.submitting}
|
|
value={props.accountInfo[props.field] || ''}
|
|
onKeyPress={props.onFieldKeyPress}
|
|
onChange={props.onFieldChange}
|
|
/>
|
|
</span>
|
|
);
|
|
}
|
|
|
|
FormField.propTypes = {
|
|
field: React.PropTypes.string,
|
|
title: React.PropTypes.string,
|
|
type: React.PropTypes.string,
|
|
style: React.PropTypes.object,
|
|
submitting: React.PropTypes.bool,
|
|
onFieldKeyPress: React.PropTypes.func,
|
|
onFieldChange: React.PropTypes.func,
|
|
errorFieldNames: React.PropTypes.array,
|
|
accountInfo: React.PropTypes.object,
|
|
}
|
|
|
|
export default FormField;
|