themesberg / themesberg/flowbite-react

Carousel should allow enable/disable controls

Open
#710 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

:rocket: enhancement help wanted
Dominant language
TypeScript
Stars
2.1k
Forks
506
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
Add a prop that enables and disables entirely the < > controls either side of a carousel. I have a solution but it means that the cursor type when hovering over the 'would be control' changes.

https://user-images.githubusercontent.com/40035529/233662484-63def9a4-1502-40e8-8a3f-0c6001c4c208.mov

Describe the solution you'd like
In my instance, I would like to turn off controls (The buttons either side of a carousel to allow a user to switch between images), if there's only 1 photo in the carousel.

Describe alternatives you've considered
Currently I'm using this sort of logic:

  const controlValue = post?.images.length > 1
    ? ""
    : " "
  
  return (
    <Carousel leftControl={controlValue} rightControl={controlValue}>
      {...}
    </Carousel>
  )

which works but could be cleaner?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Carousel component, using the existing leftControl and rightControl props as the entry point. Trace how the controls and their hover cursor are rendered, then define the new enable/disable behavior for a single-image carousel. Done means disabled controls and their hover cursor are absent while the carousel remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, tailwindcss, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.