reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

[Feature Request] Add a class when something is chosen in a List Component

Open kud opened this issue 6 years ago • 3 comments

Affected Projects React

Is your feature request related to a problem? Please describe. I don't know in CSS when a filter / facet has a value chosen.

Describe the solution you'd like For the moment I did this workaround:

            <MultiDropdownList
              className={classNames({ "MultiDropdownList": true, "MultiDropdownList--active": state.fatesFilterActive })}
              onValueChange={(value) => {
                this.setState({ fatesFilterActive: value.length > 0 })
              }}
              innerClass={{
                title: "MultiDropdownList-title",
                select: "MultiDropdownList-select",
                list: "MultiDropdownList-list",
                icon: "MultiDropdownList-icon",
                count: "MultiDropdownList-count",
              }}
/>

kud avatar Sep 19 '19 14:09 kud

We do apply a class active to the item which is currently selected. Consider the below example:

 <MultiDropdownList
    componentId="BookSensor"
    innerClass={{
         list: "list"
    }}
    dataField="original_series.raw"
    size={100}
 />

And you can use this selector:

.list .active { 
  color: red;
}

Example: https://codesandbox.io/s/multidropdownlist-kjxby

jyash97 avatar Oct 02 '19 13:10 jyash97

Reopening it because I may have interpreted incorrectly. So you want to create a class whenever a filter is active. Right?

jyash97 avatar Oct 02 '19 13:10 jyash97

I would like to know as a developer that at least one element has been selected in the list, on the whole component.

I need it to change the colour of the whole component when the filter has something selected or it's the initial state.

I don't need to change the style of the list but the style of the select in fact :D

kud avatar Oct 02 '19 13:10 kud