class FacetItem extends Component {
  constructor(props) {
    super(props);
  }
  handleClick() {
    this.props.handleClick(this.props.value, this.props.count);
  }
  render() {
    var defaultStyle = {
      margin: "5px",
      padding: "3px"
    };
    var selectedStyle = {
      margin: "5px",
      padding: "3px",
      fontWeight: "bold"
    };
    return (
      <div onClick={this.handleClick.bind(this) } style={this.props.value === this.props.selectedItem ? selectedStyle : defaultStyle}>
        <a href="#">{this.props.value} : {this.props.count}</a>
      </div>
    );
  }
}
@@ -1,8 +1,1508 @@
+import %7B default as React, Component %7D from 'react';%0Aimport %7B render %7D from 'react-dom';%0Aimport %7BqueryObject%7D from './ImmutableQuery.js';%0Avar helper = require('./helper.js');%0A%0Aexport class AppbaseFacet extends Component %7B%0A  constructor(props) %7B%0A    super(props);%0A    this.state = %7B%0A      selectedItem: %5B%5D,%0A      items: %5B%5D%0A    %7D;%0A    this.handleClick = this.handleClick.bind(this);%0A    this.appbaseRef = helper.getAppbaseRef(this.props.config);%0A    this.getItems();%0A  %7D%0A  handleClick(value) %7B%0A    this.setState(%7B%0A      selectedItem: value%0A    %7D, function()%7B%0A      console.log(value);%0A    %7D);%0A  %7D%0A  getItems() %7B%0A    var requestObject = queryObject.addAggregation();%0A    var self = this;%0A    this.appbaseRef.search(requestObject).on('data', function (data) %7B%0A      self.addItemsToList(eval(%60data.aggregations.$%7Bself.props.fieldName%7D.buckets%60));%0A    %7D).on('error', function (error) %7B%0A      console.log(error);%0A    %7D);%0A  %7D%0A  addItemsToList(newItems) %7B%0A    var updated = this.state.items;%0A    var self = this;%0A    newItems.map(function (item) %7B%0A      updated.push(%3CFacetItem key=%7Bitem.key%7D value=%7Bitem.key%7D count=%7Bitem.doc_count%7D handleClick=%7Bself.handleClick%7D selected=%7Bself.state.selectedItem%7D/%3E)%0A    %7D);%0A    this.setState(%7B items: updated %7D);%0A  %7D%0A  render() %7B%0A    let items = this.state.items;%0A    var scrollStyle = %7B%0A      overflow: %22auto%22,%0A      height: %22400px%22,%0A      width: %22400px%22,%0A      margin: %225px%22,%0A    %7D;%0A    return (%0A      %3Cdiv style=%7BscrollStyle%7D%3E%0A        %7Bitems%7D%0A      %3C/div%3E%0A    );%0A  %7D%0A%7D%0A%0A
 class Fa

Implement AppbaseFacet component