wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { ChevronRight } from '../../icons/src/vender/line/arrows'
 
export default function ContentSwitch({
  count,
  currentIndex,
  prevDisabled,
  nextDisabled,
  switchSibling,
}: {
  count?: number
  currentIndex?: number
  prevDisabled: boolean
  nextDisabled: boolean
  switchSibling: (direction: 'prev' | 'next') => void
}) {
  return (
    count && count > 1 && currentIndex !== undefined && (
      <div className="flex items-center justify-center pt-3.5 text-sm">
        <button
          className={`${prevDisabled ? 'opacity-30' : 'opacity-100'}`}
          disabled={prevDisabled}
          onClick={() => !prevDisabled && switchSibling('prev')}
        >
          <ChevronRight className="h-[14px] w-[14px] rotate-180 text-text-primary" />
        </button>
        <span className="px-2 text-xs text-text-primary">
          {currentIndex + 1} / {count}
        </span>
        <button
          className={`${nextDisabled ? 'opacity-30' : 'opacity-100'}`}
          disabled={nextDisabled}
          onClick={() => !nextDisabled && switchSibling('next')}
        >
          <ChevronRight className="h-[14px] w-[14px] text-text-primary" />
        </button>
      </div>
    )
  )
}