Skip to content

Commit

Permalink
Fix var naming, split out button component, ref #22
Browse files Browse the repository at this point in the history
  • Loading branch information
philawsophizing committed Jun 6, 2017
1 parent 513a60b commit 16ca391
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
29 changes: 11 additions & 18 deletions src/components/search_list.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import React from 'react';
import SearchButton from './search_button.jsx';

const SearchList = (props) => {
const handleClick = (guestHouse) => {
props.updateCurrent(guestHouse);
};
console.log(props);

return (
const SearchList = props =>
(
<div>
{props.db.map((guestHouses) => {
const boundItemClick = handleClick.bind(this, guestHouses.name);
return (
<button
key={guestHouses.name}
onClick={boundItemClick}>
{guestHouses.name}
</button>
);
})}
{props.db.map(guestHouses =>
// const boundItemClick = handleClick.bind(this, guestHouses.name);
<SearchButton
key={guestHouses.name}
clickHandler={props.updateCurrent}
currentGHouse={guestHouses.name}
/>,
)}
</div>
);
};

export default SearchList;
8 changes: 5 additions & 3 deletions src/containers/select_guesthouse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ class SelectGuesthouse extends Component {
constructor(props) {
super(props);
this.state = {
title: 'PAS',
tagLine: 'Park & Sleep',
db: [],
currentGuestHouse: {},
};
this.currentGuestHouse = this.currentGuestHouse.bind(this);
}

currentGuestHouse(guestHouse) {
const current = this.state.db.filter((curr) => {
if (curr.name === guestHouse) {
return curr;
const current = this.state.db.filter((GHouse) => {
if (GHouse.name === guestHouse) {
return GHouse;
}
return current;
});
Expand Down

0 comments on commit 16ca391

Please sign in to comment.