( props: VoidProps<ComponentProps<typeof Button>>, )
| 184 | }; |
| 185 | |
| 186 | export const CarouselPrevious = ( |
| 187 | props: VoidProps<ComponentProps<typeof Button>>, |
| 188 | ) => { |
| 189 | const merge = mergeProps<VoidProps<ComponentProps<typeof Button>[]>>( |
| 190 | { variant: "outline", size: "icon" }, |
| 191 | props, |
| 192 | ); |
| 193 | const [local, rest] = splitProps(merge, ["class", "variant", "size"]); |
| 194 | const { orientation, scrollPrev, canScrollPrev } = useCarousel(); |
| 195 | |
| 196 | return ( |
| 197 | <Button |
| 198 | variant={local.variant} |
| 199 | size={local.size} |
| 200 | class={cn( |
| 201 | "absolute h-8 w-8 touch-manipulation rounded-full", |
| 202 | orientation === "horizontal" |
| 203 | ? "-left-12 top-1/2 -translate-y-1/2" |
| 204 | : "-top-12 left-1/2 -translate-x-1/2 rotate-90", |
| 205 | local.class, |
| 206 | )} |
| 207 | disabled={!canScrollPrev()} |
| 208 | onClick={scrollPrev} |
| 209 | {...rest} |
| 210 | > |
| 211 | <svg |
| 212 | xmlns="http://www.w3.org/2000/svg" |
| 213 | viewBox="0 0 24 24" |
| 214 | class="size-4" |
| 215 | > |
| 216 | <path |
| 217 | fill="none" |
| 218 | stroke="currentColor" |
| 219 | strokeLinecap="round" |
| 220 | strokeLinejoin="round" |
| 221 | strokeWidth="2" |
| 222 | d="M5 12h14M5 12l6 6m-6-6l6-6" |
| 223 | /> |
| 224 | <title>Previous slide</title> |
| 225 | </svg> |
| 226 | </Button> |
| 227 | ); |
| 228 | }; |
| 229 | |
| 230 | export const CarouselNext = ( |
| 231 | props: VoidProps<ComponentProps<typeof Button>>, |
nothing calls this directly
no test coverage detected