From ba5750a20d90d748714ada49823cd5b0f512b290 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Tue, 19 Feb 2019 11:41:11 -0300 Subject: [PATCH] tag selector component pt1 --- client/src/core-components/tag-selector.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 client/src/core-components/tag-selector.js diff --git a/client/src/core-components/tag-selector.js b/client/src/core-components/tag-selector.js new file mode 100644 index 00000000..5a342ec3 --- /dev/null +++ b/client/src/core-components/tag-selector.js @@ -0,0 +1,39 @@ +import React from 'react'; +import _ from 'lodash'; +import Icon from 'core-components/icon'; + +class TagSelector extends React.Component { + + static propTypes = { + items: React.PropTypes.arrayOf(React.PropTypes.shape({ + name: React.PropTypes.string, + color: React.PropTypes.string + })), + values: React.PropTypes.arrayOf(React.PropTypes.string) + }; + + render() { + return ( +
+
+

Tags

+
{this.renderItemsList()}
+
+
{this.props.values.join()}
+
+ ); + } + renderItemsList() { + const itemList = _.filter(this.props.items,(item) => !_.includes(this.props.values,item.name)); + console.log('la lista de items librs',itemList); + return itemList.map((item,index) => { + return( + + {item.name} + x + + ) + }); + } +} +export default TagSelector;