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

feat: add transformItems to all widgets #66

Merged
merged 6 commits into from
Aug 13, 2018
Merged

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Aug 10, 2018

No description provided.

@Haroenv Haroenv requested review from samouss and a team August 10, 2018 08:56
@algobot
Copy link

algobot commented Aug 10, 2018

Deploy preview for instantsearch-css ready!

Built with commit 3339d41

https://deploy-preview-66--instantsearch-css.netlify.com

@@ -144,4 +144,6 @@ options:
- name: autofocus
default: false
description: Focus on the input automatically
- name: transformItems
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one is new, but I think it should have it too

Copy link
Contributor

Choose a reason for hiding this comment

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

There is no items so the name transformItems feels a bit odd. The purpose of it is to transform query so transformQuery or whatever.

@@ -11,4 +11,7 @@ classes:
- name: .ais-Stats-text
description: the text of the widget
description: the count of items for each item
options:
- name: transformItems
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not included in IS.js but I think it should have been

@@ -27,4 +27,6 @@ options:
- name: clearsQuery
default: false
description: Also clears the query
- name: transformItems
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not included in IS.js but I think it should have been

Copy link
Member

Choose a reason for hiding this comment

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

It's named ClearAll in IS.js for now. We need to implement transformItems once we rework the widget and name it ClearRefinements.

@Haroenv
Copy link
Contributor Author

Haroenv commented Aug 10, 2018

see also algolia/instantsearch#3042

Copy link
Contributor

@samouss samouss left a comment

Choose a reason for hiding this comment

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

What about RatingMenu ?

@@ -144,4 +144,6 @@ options:
- name: autofocus
default: false
description: Focus on the input automatically
- name: transformItems
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no items so the name transformItems feels a bit odd. The purpose of it is to transform query so transformQuery or whatever.

@@ -18,4 +18,6 @@ classes:
options:
- name: items
description: Array of objects with the value, the label and a boolean "default" which decides which item to select by default
- name: transformItems
description: Functions which receives the items, which will be called before displaying them, useful for mapping over the items to transform them. Return a new array with the same shape as the original array.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: It's a single function

The first sentence is a bit long and it presents 2 aspects: the description itself and the the use case (which is a great idea). I would split it in two.

In the last sentence I'm not sure we should go for return or returns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also it's not only mapping: mapping, filtering and enhancing the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function which receives the items, which will be called before displaying them. Should return a new array with the same shape as the original array. Useful for mapping over the items to transform, remove or reorder them

@@ -144,4 +144,6 @@ options:
- name: autofocus
default: false
description: Focus on the input automatically
- name: transformQuery
Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep this for a separate proposal

Copy link
Contributor

@bobylito bobylito left a comment

Choose a reason for hiding this comment

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

👍

@Haroenv Haroenv merged commit 1a6456a into master Aug 13, 2018
@Haroenv Haroenv deleted the feat/transformItems branch August 13, 2018 14:31
sarahdayan pushed a commit to algolia/instantsearch that referenced this pull request Dec 14, 2022
* feat: add transformItems to all widgets

* add to ratingMenu

* change name

* remove searchbox

* chore: update text
sarahdayan pushed a commit to algolia/instantsearch that referenced this pull request Dec 14, 2022
* feat: add transformItems to all widgets

* add to ratingMenu

* change name

* remove searchbox

* chore: update text
sarahdayan pushed a commit to algolia/instantsearch that referenced this pull request Dec 15, 2022
* feat: add transformItems to all widgets

* add to ratingMenu

* change name

* remove searchbox

* chore: update text
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants