Skip to content

Instantly share code, notes, and snippets.

@KensoDev
Last active August 29, 2016 19:11
Show Gist options
  • Select an option

  • Save KensoDev/683b6d72ea4b6e7f6fe5fe8b8f841f67 to your computer and use it in GitHub Desktop.

Select an option

Save KensoDev/683b6d72ea4b6e7f6fe5fe8b8f841f67 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import ItemListCounter from '../../../lib/Helpers/ItemListCounter';
import Counter from '../../Counter';
require('./style.scss');
class ItemTypeSelector extends Component {
constructor(props) {
super(props);
this._handeSelect = props.handleSelect.bind(this);
}
isSelectedClassName(itemType) {
if (this.props.selected.indexOf(itemType) > -1) {
return "selected";
}
return "";
}
render() {
let counter = new ItemListCounter(this.props.items);
let total = counter.count();
let hotelCount = counter.countFor('Hotel');
let restaurantCount = counter.countFor('Restaurant');
let attractionCount = counter.countFor('Attraction');
return (
<div className="navigationWrapper" id="navigationWrapper">
<a href="#" onClick={ () => this._handeSelect('Hotel') } className={ this.isSelectedClassName('Hotel') }>Hotel</a>
<a href="#" onClick={ () => this._handeSelect('Restaurant') } className={ this.isSelectedClassName('Restaurant') }>Restaurant</a>
<a href="#" onClick={ () => this._handeSelect('Attraction') } className={ this.isSelectedClassName('Attraction') }>Attraction</a>
</div>
);
}
}
export default ItemTypeSelector;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment