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

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

const { variations } = useProduct()
const { currentVariant } = 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>
