Skip to content

Commit

Permalink
fix: options are now horizontal
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaspalma committed Sep 5, 2024
1 parent 5ca88d4 commit 0bd5ce1
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions src/components/planner/sidebar/OptionsController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,34 @@ const OptionsController = () => {
const { multipleOptions, selectedOption, setSelectedOption, setMultipleOptions } = useContext(MultipleOptionsContext);

return (
<ReactSortable
className="m-y-2 flex flex-row justify-center gap-2 overflow-x-auto py-2 text-center w-full lg:justify-start"
list={multipleOptions}
setList={(newMultipleOptions) => {
const prevId = multipleOptions[selectedOption].id;
setMultipleOptions(newMultipleOptions);
if (newMultipleOptions[selectedOption].id !== prevId) {
setSelectedOption(newMultipleOptions.findIndex((currentOption) => currentOption.id === prevId));
<div className="overflow-x-scroll">
<ReactSortable
className="m-y-2 flex flex-row justify-center gap-2 overflow-x-auto py-2 text-center w-full lg:justify-start"
list={multipleOptions}
setList={(newMultipleOptions) => {
const prevId = multipleOptions[selectedOption].id;
setMultipleOptions(newMultipleOptions);
if (newMultipleOptions[selectedOption].id !== prevId) {
setSelectedOption(newMultipleOptions.findIndex((currentOption) => currentOption.id === prevId));
}
}
}
}
group="groupName"
animation={200}
delay={2}
multiDrag
onEnd={() => {
AnalyticsTracker.trackFeature(Feature.OPTION_REORDER);
}}
>
{multipleOptions.map((option: Option) => (
<OptionButton
key={multipleOptions.findIndex((currentOption) => currentOption.id === option.id)}
option={option}
/>
))}
</ReactSortable>
}
group="groupName"
animation={200}
delay={2}
multiDrag
onEnd={() => {
AnalyticsTracker.trackFeature(Feature.OPTION_REORDER);
}}
>
{multipleOptions.map((option: Option) => (
<OptionButton
key={multipleOptions.findIndex((currentOption) => currentOption.id === option.id)}
option={option}
/>
))}
</ReactSortable>
</div>
)
}

Expand Down

0 comments on commit 0bd5ce1

Please sign in to comment.