BelkacemYerfa / shadcn-extension

An open source component collection , that extends your ui library , built using shadcn component
https://shadcn-extension.vercel.app/
MIT License
695 stars 22 forks source link

👌 IMPROVE(carousel): fix missing classname, use data attribute for thumbs #23

Closed ahmedrowaihi closed 6 months ago

ahmedrowaihi commented 6 months ago

to allow overwriting styles of active thumb, dynamically with isSlideActive using className

BelkacemYerfa commented 6 months ago

Thanks @ahmedrowaihi for your contribution , but i tested the code for the data-attr modification , and that will not work , since you have forget to add the data-active attr for the button.

As you can see here :

image

the proper fix will be to add the data-active={isSlideActive} to the button so it will now that the state of the active data attr has been changed.

The new modification will result :

image ,

the code for that is :

<Button
  ref={ref}
  size="icon"
  data-active={isSlideActive}
  className={cn(
    "h-1 w-6 rounded-full",
    "data-[active='false']:bg-primary/50 data-[active='true']:bg-primary",
    className
  )}
  onClick={() => onThumbClick(index)}
  {...props}
>
    <span className="sr-only">slide {index + 1} </span>
</Button>

Please consider this change if you want the pr get merged.

ahmedrowaihi commented 6 months ago

oopss! my bad, I forgot to add it

ahmedrowaihi commented 6 months ago

there you go boss

BelkacemYerfa commented 6 months ago

Thanks you for your help @ahmedrowaihi.

Welcome to contribution club , as the first contributor 💪. Don't forget to spread the word on Reddit or similar. Enjoy 🎉!