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

docs(tourism): fix capacity selector #373

Merged
merged 1 commit into from
Sep 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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