<template>
  <LayoutContainer>
    <v-row justify="center">
      <h2 class="title text-center" :style="{ color: titleColor }">
        Plus de&nbsp;
        <span style="color: #c3e5e7">{{ structureCount }}</span
        >&nbsp; {{ trustMessage }}
      </h2>
    </v-row>

    <v-row justify="center"> </v-row>

    <v-container>
      <v-row>
      <div
        class="carousel-button"
        @click="goPrevious"
        :style="{
          'border-color': carouselBorderColor,
          color: carouselButtonColor,
        }"
      >
        <i class="fas fa-chevron-left" :style="{ color: iconColor }" />
      </div>
      <Carousel
        ref="carousel"
        class="carrousel elevation-4 mb-12"
        :items-to-show="4"
        :items-to-scroll="2"
      >
        <Slide v-for="(item, index) in items" :key="index">
          <div class="card">
            <v-img class="card-img" :src="item.src" alt="Card image cap" />
          </div>
        </Slide>
      </Carousel>
      <div
        class="carousel-button"
        @click="goNext"
        :style="{
          'border-color': carouselBorderColor,
          color: carouselButtonColor,
        }"
      >
        <i class="fas fa-chevron-right" :style="{ color: iconColor }" />
      </div>
    </v-row>
    </v-container>

  </LayoutContainer>
</template>

<script setup>
import { ref } from "vue";
import { Carousel, Slide } from "vue3-carousel";
const carousel = ref(null);

const props = defineProps({
  titleColor: String,
  carouselButtonColor: String,
  carouselBorderColor: String,
  items: Array,
  iconColor: String,
  trustMessage: {
    type: String,
    default: "nous font confiance",
  },
  structureCount: {
    type: String,
    default: "5000 structures",
  },
});

const goPrevious = () => {
  carousel.value.prev();
};

const goNext = () => {
  carousel.value.next();
};


</script>

<style scoped>
.v-row {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1300px;
  margin-right: auto;
  margin-left: auto;
}
.carousel-button i {
  color: black;
}

.carousel-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  background-color: transparent;
  border: 2px solid black;
  cursor: pointer;
  margin-right: 1rem;
  margin-top: 1rem;
}
.card-img {
  height: 10rem;
  width: 10rem;
  margin-left: auto;
  margin-right: auto;
  margin-top: 2rem;
  margin-bottom: 2rem;
}
.carousel {
  background-color: white;
  margin-top: 2rem;
  border-radius: 20px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: #071b1f;
}

.title {
  margin-bottom: 2rem;
  font-style: normal;
  text-align: center;
  color: black;
  font-weight: 600;
  font-size: 42px;
  line-height: 42px;
  text-align: center;
  color: #0e2d32;
  width: 50%;
}
</style>
