Mailspring/app/internal_packages/composer/lib/subject-text-field.jsx

41 lines
818 B
React
Raw Normal View History

2017-09-27 02:33:08 +08:00
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class SubjectTextField extends Component {
2017-09-27 02:33:08 +08:00
static displayName = 'SubjectTextField';
2017-09-27 02:33:08 +08:00
static containerRequired = false;
static propTypes = {
value: PropTypes.string,
onSubjectChange: PropTypes.func,
2017-09-27 02:33:08 +08:00
};
2017-09-27 02:33:08 +08:00
onInputChange = ({ target: { value } }) => {
this.props.onSubjectChange(value);
};
focus() {
2017-09-27 02:33:08 +08:00
this._el.focus();
}
render() {
2017-09-27 02:33:08 +08:00
const { value } = this.props;
return (
<div className="composer-subject subject-field">
<input
2017-09-27 02:33:08 +08:00
ref={el => {
this._el = el;
}}
type="text"
name="subject"
placeholder="Subject"
value={value}
onChange={this.onInputChange}
/>
</div>
);
}
}