client/src/components/CategoriesTooltip.js
changeset 21 284e866f55c7
child 25 e04714a1d4eb
equal deleted inserted replaced
20:a8300ef1876e 21:284e866f55c7
       
     1 import React, { Component } from 'react';
       
     2 import { FormGroup, FormControl, Button } from 'react-bootstrap';
       
     3 
       
     4 class CategoriesTooltip extends Component {
       
     5 
       
     6   onButtonClick = (category) => {
       
     7     if (typeof this.props.onCategoryClick === 'function') {
       
     8       this.props.onCategoryClick(category)
       
     9     }
       
    10   }
       
    11 
       
    12   render() {
       
    13     return (
       
    14       <div className="categories-tooltip">
       
    15         <FormGroup className="buttons">
       
    16         {this.props.categories.map((category) =>
       
    17           <Button key={ category.name } bsStyle="primary" style={{ backgroundColor: category.color }}
       
    18             onClick={this.onButtonClick.bind(this, category)}>{ category.name }</Button>
       
    19         )}
       
    20         </FormGroup>
       
    21         <FormGroup>
       
    22           <FormControl />
       
    23         </FormGroup>
       
    24       </div>
       
    25     );
       
    26   }
       
    27 }
       
    28 
       
    29 export default CategoriesTooltip