Skip to content

API-1813 Allow Selecting Multiple in renderToolbarSearchDropdown #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 12, 2021

Conversation

boygao1992
Copy link
Member

@boygao1992 boygao1992 commented Oct 12, 2021

What does this pull request do?

Before Ocelot.Typeahead.renderToolbarSearchDropdown was fixed to Maybe for single selection but we need it to support multiple selection with Array so we loosen renderSearchDropdown and renderToolbarSearchDropdown to support Foldable instead of just Maybe.

How should this be manually tested?

  • make
  • open /dist/index.html#typeaheads and scroll down to the bottom, the last one should be a multi-select toolbar search dropdown
  • open that dropdown and select a few, the text render is configured as the following
    • if there's no selection, show a default text (All Locations)
    • if there's a single selection, show that selected location
    • if there's multiple selections, show the number of selections

We need a multi-select version of `renderToolbarSearchDropdown` which returns
`Array` instead of `Maybe`. `renderToolbarSearchDropdown` depends on
`renderSearchDropdown` so we start from here.
We used to take a default label String and a text render function for a single
selection with `Maybe` in `renderToolbarSearchDropdown`. Now we want to support
multiple selections with `Array`, the presentation of text as a summary of
selections could vary depending on different situations, e.g. a comma separated
list of all selections, or the count of selections, etc. so we let users to
provide the render function instead of making a decision for them.
@boygao1992 boygao1992 requested a review from allgooda October 12, 2021 19:04
Copy link

@allgooda allgooda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@boygao1992
Copy link
Member Author

Thanks for the review!

@boygao1992 boygao1992 merged commit 9d668ce into main Oct 12, 2021
@boygao1992 boygao1992 deleted the API-1813/multi-select-toolbar-search-dropdown branch October 12, 2021 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants