react-carousel icon indicating copy to clipboard operation
react-carousel copied to clipboard

Active classname for all visible elements

Open PiotrSzlagura opened this issue 4 years ago • 7 comments

Is your feature request related to a problem? Please describe. I'm not 100% sure if it's a feature request, bug or is it already possible with current version.

Describe the solution you'd like Right now if slidesPerPage > 1, only one item gets className BrainhubCarouselItem--active. Is there a way to add this className to every currently visible element? Or something else, like BrainhubCarouselItem--visible etc...

Describe alternatives you've considered I tried working around it by altering classnames of children passed down to carousel and calculating (or assuming) when they are visible, but I think it's mixing responsibilities, so I dropped this idea.

Additional context Add any other context or screenshots about the feature request here.

Cały_ekran_10_03_2020__11_27

Thanks in advance for your help!

PiotrSzlagura avatar Mar 10 '20 10:03 PiotrSzlagura

@PiotrSzlagura

It seems to be a bug. Thanks for reporting. Maybe we'll fix that but your PR will be more than welcome.

piotr-s-brainhub avatar Mar 10 '20 13:03 piotr-s-brainhub

I'll try to approach this today :)

PiotrSzlagura avatar Mar 10 '20 14:03 PiotrSzlagura

@PiotrSzlagura

We decided to improve your PR.

Or maybe you could do that but you need to consult that with @RobertHebel and @humbak .

piotr-s-brainhub avatar May 11 '20 19:05 piotr-s-brainhub

I got a little bit lost with my assumptions and then forgot about this thread, sorry. Please tell me if my thinking is correct:

  • If slidesPerPage is integer, then there are no partially visible items
  • If slidesPerPage is float, then there are two partially visible items: one before first visible, and one after last visible item
  • There can never be more than 2 partially visible items.

Am I right?

PiotrSzlagura avatar May 11 '20 22:05 PiotrSzlagura

@PiotrSzlagura

IMO slidesPerPage should be always an integer.

piotr-s-brainhub avatar May 13 '20 14:05 piotr-s-brainhub

@piotr-s-brainhub I don't agree. Having possibility to set non-integer slidesPerPage is common in sliders libs (intentional or not) and I personally am using it a lot, so I think it's good that it's there.

PiotrSzlagura avatar May 13 '20 14:05 PiotrSzlagura

@PiotrSzlagura

So I'm OK with that, it can be a non-integer.

piotr-s-brainhub avatar May 14 '20 02:05 piotr-s-brainhub