Skip to content
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

Add individual CarouselItem intervals #5305

Closed
kyletsang opened this issue Jul 16, 2020 · 5 comments · Fixed by #5359
Closed

Add individual CarouselItem intervals #5305

kyletsang opened this issue Jul 16, 2020 · 5 comments · Fixed by #5359

Comments

@kyletsang
Copy link
Member

https://getbootstrap.com/docs/4.5/components/carousel/#individual-carousel-item-interval

@jquense
Copy link
Member

jquense commented Jul 16, 2020

oof that is not straight forward :/

@bpas247
Copy link
Member

bpas247 commented Aug 1, 2020

So if I'm understanding the feature correctly, the API would look something like

<Carousel>
  <Carousel.Item interval={10000}>
    <img
      className="d-block w-100"
      src="holder.js/800x400?text=First slide&bg=373940"
      alt="First slide"
    />
    <Carousel.Caption>
      <h3>First slide label</h3>
      <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
    </Carousel.Caption>
  </Carousel.Item>
  <Carousel.Item interval={2000}>
    <img
      className="d-block w-100"
      src="holder.js/800x400?text=Second slide&bg=282c34"
      alt="Second slide"
    />
    <Carousel.Caption>
      <h3>Second slide label</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    </Carousel.Caption>
  </Carousel.Item>
</Carousel>

A couple questions regarding this:

  • Since the Carousel component handles all of the state, should we go about communicating the children's interval prop values to the Carousel component?
    What we could do is store an object in a ref, and mutate it when we map over all of the children with the values of child.props.interval, which we could then use as a lookup table for setting the proper interval time, although I'm not sure if there's a better way of approaching that.
  • In the event that Carousel is also passed an interval prop, what would take precedence?
    I would imagine the Carousel's interval value would, but just wanted to confirm.

@kyletsang
Copy link
Member Author

In the bootstrap example, it looks like the children intervals take precedence, and in the absence of a child interval, the Carousel interval would be used.

@taion
Copy link
Member

taion commented Aug 3, 2020

Child interval values might not be too bad... we need to iterate through the children to count them anyway, so why not also grab their intervals when we do so?

@bpas247
Copy link
Member

bpas247 commented Aug 4, 2020

we need to iterate through the children to count them anyway, so why not also grab their intervals when we do so?

Yep, that's the current plan I'm going with 👍 just need to get it working lol

bpas247 added a commit that referenced this issue Aug 4, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

TODOs:
- [ ] Add prop types for the `interval` prop for `CarouselItem`

fixes #5305
bpas247 added a commit that referenced this issue Aug 4, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

TODOs:
- [ ] Add prop types for the `interval` prop for `CarouselItem`

fixes #5305
bpas247 added a commit that referenced this issue Aug 4, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

TODOs:
- [ ] Add prop types for the `interval` prop for `CarouselItem`

fixes #5305
bpas247 added a commit that referenced this issue Aug 6, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

TODOs:
- [ ] Add prop types for the `interval` prop for `CarouselItem`

fixes #5305
bpas247 added a commit that referenced this issue Aug 7, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

TODOs:
- [ ] Add prop types for the `interval` prop for `CarouselItem`

fixes #5305
bpas247 added a commit that referenced this issue Aug 7, 2020
Adds the ability to specify intervals per-item, which should
hopefully match the functionality of the upstream feature.

fixes #5305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants