client/src/components/CategoriesTooltip.js
changeset 21 284e866f55c7
child 25 e04714a1d4eb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/components/CategoriesTooltip.js	Thu Jun 08 11:13:41 2017 +0200
@@ -0,0 +1,29 @@
+import React, { Component } from 'react';
+import { FormGroup, FormControl, Button } from 'react-bootstrap';
+
+class CategoriesTooltip extends Component {
+
+  onButtonClick = (category) => {
+    if (typeof this.props.onCategoryClick === 'function') {
+      this.props.onCategoryClick(category)
+    }
+  }
+
+  render() {
+    return (
+      <div className="categories-tooltip">
+        <FormGroup className="buttons">
+        {this.props.categories.map((category) =>
+          <Button key={ category.name } bsStyle="primary" style={{ backgroundColor: category.color }}
+            onClick={this.onButtonClick.bind(this, category)}>{ category.name }</Button>
+        )}
+        </FormGroup>
+        <FormGroup>
+          <FormControl />
+        </FormGroup>
+      </div>
+    );
+  }
+}
+
+export default CategoriesTooltip