<script setup lang="ts">
import type { WithClassAsProps } from "./interface"
import { cn } from "@/lib/utils"
import { useCarousel } from "./useCarousel"
import ArrowIcon from '@/pages/Home/modules4/arrow.svg?component'

const props = defineProps<WithClassAsProps>()

const { orientation, canScrollPrev, scrollPrev } = useCarousel()
</script>

<template>
  <button
    data-slot="carousel-previous"
    :class="cn(
      'absolute cursor-pointer z-10',
      orientation === 'horizontal'
        ? 'top-1/2 -left-12 -translate-y-1/2'
        : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
      props.class,
    )"
    @click="scrollPrev"
  >
    <slot>
      <ArrowIcon class="h-[120px] w-auto" />
      <span class="sr-only">Previous Slide</span>
    </slot>
  </button>
</template>
