Speedometer: Add a React + Redux TodoMVC implementation
[WebKit-https.git] / PerformanceTests / Speedometer / resources / todomvc / architecture-examples / react-redux / src / components / Header.js
1 import React, { PropTypes, Component } from 'react'
2 import TodoTextInput from './TodoTextInput'
3
4 export default class Header extends Component {
5   static propTypes = {
6     addTodo: PropTypes.func.isRequired
7   }
8
9   handleSave = text => {
10     if (text.length !== 0) {
11       this.props.addTodo(text)
12     }
13   }
14
15   render() {
16     return (
17       <header className="header">
18         <h1>todos</h1>
19         <TodoTextInput newTodo
20                        onSave={this.handleSave}
21                        placeholder="What needs to be done?" />
22       </header>
23     )
24   }
25 }