mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
40 lines
795 B
React
40 lines
795 B
React
|
import React, {Component, PropTypes} from 'react'
|
||
|
import {findDOMNode} from 'react-dom'
|
||
|
|
||
|
|
||
|
export default class SubjectTextField extends Component {
|
||
|
static displayName = 'SubjectTextField'
|
||
|
|
||
|
static containerRequired = false
|
||
|
|
||
|
static propTypes = {
|
||
|
value: PropTypes.string,
|
||
|
onSubjectChange: PropTypes.func,
|
||
|
}
|
||
|
|
||
|
onInputChange = ({target: {value}}) => {
|
||
|
this.props.onSubjectChange(value)
|
||
|
}
|
||
|
|
||
|
focus() {
|
||
|
findDOMNode(this.refs.input).focus()
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
const {value} = this.props
|
||
|
|
||
|
return (
|
||
|
<div className="composer-subject subject-field">
|
||
|
<input
|
||
|
ref="input"
|
||
|
type="text"
|
||
|
name="subject"
|
||
|
placeholder="Subject"
|
||
|
value={value}
|
||
|
onChange={this.onInputChange}
|
||
|
/>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
}
|