Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
docs(tourism): fix capacity selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Marie-Laure Thuret committed Sep 25, 2017
1 parent 485600c commit 801aaed
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions docgen/src/examples/tourism/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,30 +193,14 @@ OptionCapacity.propTypes = {
const CapacitySelector = connectMultiRange(
({ items, currentRefinement, refine }) => {
const selectValue = e => refine(e.target.value);

const allOption = (
const options = items.map(item => (
<OptionCapacity
label=""
value=""
isSelected={Boolean(currentRefinement)}
key="all"
label={item.label}
value={item.value}
isSelected={item.isRefined}
key={item.value}
/>
);

const options = items.map(item => {
const val = parseFloat(item.value.split(':')[0]);
const label = `${val} person${val > 1 ? 's' : ''}`;
return (
<OptionCapacity
label={label}
value={item.value}
isSelected={item.isRefined}
key={item.value}
/>
);
});

options.unshift(allOption);
));

return (
<div className="capacity-menu-wrapper">
Expand Down

0 comments on commit 801aaed

Please sign in to comment.