({
segment,
className,
intent = 'outline',
isCircle = true,
size = 'sq-sm',
ref,
...props
}: ButtonProps & { segment: 'previous' | 'next' })
| 193 | } |
| 194 | |
| 195 | const CarouselButton = ({ |
| 196 | segment, |
| 197 | className, |
| 198 | intent = 'outline', |
| 199 | isCircle = true, |
| 200 | size = 'sq-sm', |
| 201 | ref, |
| 202 | ...props |
| 203 | }: ButtonProps & { segment: 'previous' | 'next' }) => { |
| 204 | const { orientation, scrollPrev, canScrollPrev, scrollNext, canScrollNext } = useCarousel() |
| 205 | const isNext = segment === 'next' |
| 206 | const canScroll = isNext ? canScrollNext : canScrollPrev |
| 207 | const scroll = isNext ? scrollNext : scrollPrev |
| 208 | const Icon = isNext ? ChevronRightIcon : ChevronLeftIcon |
| 209 | |
| 210 | return ( |
| 211 | <Button |
| 212 | aria-label={isNext ? 'Next slide' : 'Previous slide'} |
| 213 | data-handler={segment} |
| 214 | intent={intent} |
| 215 | ref={ref} |
| 216 | size={size} |
| 217 | isCircle={isCircle} |
| 218 | className={cx([orientation === 'vertical' ? 'rotate-90' : '', 'shrink-0'], className)} |
| 219 | isDisabled={!canScroll} |
| 220 | onPress={scroll} |
| 221 | {...props} |
| 222 | > |
| 223 | <Icon className="size-4" /> |
| 224 | </Button> |
| 225 | ) |
| 226 | } |
| 227 | |
| 228 | export type { CarouselApi } |
| 229 | export { Carousel, CarouselButton, CarouselContent, CarouselHandler, CarouselItem } |
nothing calls this directly
no test coverage detected