style(dashboard-v2): simplify 'key' props
This commit is contained in:
parent
7adbc4bf68
commit
7681287127
|
@ -9,11 +9,12 @@ export default function Bullets({ visibleSlides, activeIndex, allSlides, changeS
|
|||
<div className="flex gap-3 pt-6">
|
||||
{Array(allSlides - visibleSlides + 1)
|
||||
.fill(null)
|
||||
.map((_, i) => (
|
||||
<span
|
||||
key={`slider-bullets-${i}`}
|
||||
className={`rounded-full w-3 h-3 ${activeIndex === i ? "bg-primary" : "border-2 cursor-pointer"}`}
|
||||
onClick={() => changeSlide(i)}
|
||||
.map((_, index) => (
|
||||
<button
|
||||
key={index}
|
||||
type="button"
|
||||
className={`rounded-full w-3 h-3 ${activeIndex === index ? "bg-primary" : "border-2 cursor-pointer"}`}
|
||||
onClick={() => changeSlide(index)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
@ -55,14 +55,14 @@ const Slider = ({ slides, breakpoints }) => {
|
|||
$activeIndex={activeIndex}
|
||||
$scrollable={scrollable}
|
||||
>
|
||||
{slides.map((slide, i) => {
|
||||
const isVisible = i >= activeIndex && i < activeIndex + visibleSlides;
|
||||
{slides.map((slide, index) => {
|
||||
const isVisible = index >= activeIndex && index < activeIndex + visibleSlides;
|
||||
|
||||
return (
|
||||
<div key={`slide-${i}`}>
|
||||
<div key={`slide-${index}`}>
|
||||
<Slide
|
||||
isVisible={isVisible || !scrollable}
|
||||
onClick={scrollable && !isVisible ? () => changeSlide(i) : null}
|
||||
onClick={scrollable && !isVisible ? () => changeSlide(index) : null}
|
||||
>
|
||||
{slide}
|
||||
</Slide>
|
||||
|
|
Reference in New Issue