Fix Lists edit form

[MAILPOET-1348]
This commit is contained in:
Pavel Dohnal
2018-04-19 14:33:08 +01:00
parent c105df1635
commit 32a759eca5
2 changed files with 28 additions and 9 deletions

View File

@ -1,17 +1,29 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types';
const FormFieldTextarea = () => ( const FormFieldTextarea = props => (
<textarea <textarea
type="text" type="text"
className="regular-text" className="regular-text"
name={this.props.field.name} name={props.field.name}
id={`field_${this.props.field.name}`} id={`field_${props.field.name}`}
value={this.props.item[this.props.field.name]} value={props.item[props.field.name]}
placeholder={this.props.field.placeholder} placeholder={props.field.placeholder}
defaultValue={this.props.field.defaultValue} defaultValue={props.field.defaultValue}
onChange={this.props.onValueChange} onChange={props.onValueChange}
{...this.props.field.validation} {...props.field.validation}
/> />
); );
FormFieldTextarea.propTypes = {
item: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
field: PropTypes.shape({
name: PropTypes.string,
placeholder: PropTypes.string,
defaultValue: PropTypes.string,
validation: PropTypes.object, // eslint-disable-line react/forbid-prop-types
}).isRequired,
onValueChange: PropTypes.func.isRequired,
};
export default FormFieldTextarea; export default FormFieldTextarea;

View File

@ -2,6 +2,7 @@ import React from 'react';
import { Link } from 'react-router'; import { Link } from 'react-router';
import MailPoet from 'mailpoet'; import MailPoet from 'mailpoet';
import Form from 'form/form.jsx'; import Form from 'form/form.jsx';
import PropTypes from 'prop-types';
const fields = [ const fields = [
{ {
@ -29,7 +30,7 @@ const messages = {
}, },
}; };
const SegmentForm = params => ( const SegmentForm = ({ params }) => (
<div> <div>
<h1 className="title"> <h1 className="title">
{MailPoet.I18n.t('segment')} {MailPoet.I18n.t('segment')}
@ -45,4 +46,10 @@ const SegmentForm = params => (
</div> </div>
); );
SegmentForm.propTypes = {
params: PropTypes.shape({
id: PropTypes.string,
}).isRequired,
};
export default SegmentForm; export default SegmentForm;