<template>
  <div class="product-variations">
    <div
      v-for="variation in productsVariationsData"
      :key="variation?.id"
      @click="() => currentVariantId = variation?.id"
    >
      <div class="product-variations__variation">
        <img width="80" :src="variation?.image?.src" :alt="variation?.image?.src">
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useCurrentProduct, useProduct } from '~/composables'

const { productsVariationsData } = useProduct()
const { currentVariantId } = useCurrentProduct()
</script>

<style lang="scss">
.product-variations {
  padding: 10px;
  border-radius: 10px;
  background: white;
  display: flex;
  flex-direction: row;
  gap: 4px;

  &__variation {
    img {
      border-radius: 10px;
      cursor: pointer;
    }
  }
}
</style>
