<script setup lang="ts">
defineProps<{
  account: string;
  accountUrl: string;
  feedImages: string[]; // ordonné du plus récent (haut) au plus ancien (bas)
}>();
</script>

<template>
  <section class="border-b border-neutral-200 last:border-b-0">
    <header class="px-4 py-3 flex items-center justify-between">
      <a
        :href="accountUrl"
        target="_blank"
        rel="noopener"
        class="font-medium text-sm hover:underline"
      >
        {{ account }}
      </a>
    </header>

    <div class="insta-feed-scroll">
      <a
        :href="accountUrl"
        target="_blank"
        rel="noopener"
        :aria-label="`Voir le compte Instagram ${account}`"
      >
        <img
          v-for="(src, i) in feedImages"
          :key="i"
          :src="src"
          alt=""
          loading="lazy"
          class="block w-full feed-img"
        />
      </a>
    </div>

    <div class="flex gap-1 px-2 py-1">
      <a
        :href="accountUrl"
        target="_blank"
        rel="noopener"
        class="flex-1 text-center px-1.5 py-1 bg-neutral-900 text-white rounded text-[10px] leading-tight"
      >
        Compte Insta artistique
      </a>
      <span
        class="flex-1 text-center px-1.5 py-1 bg-neutral-200 text-neutral-400 rounded text-[10px] leading-tight cursor-not-allowed"
        aria-disabled="true"
        title="Boutique — bientôt disponible"
      >
        Boutique
      </span>
      <span
        class="flex-1 text-center px-1.5 py-1 bg-neutral-200 text-neutral-400 rounded text-[10px] leading-tight cursor-not-allowed"
        aria-disabled="true"
        title="Compte Insta politique (@aep.politique) — bientôt disponible"
      >
        Compte Insta politique
      </span>
    </div>
  </section>
</template>

<style scoped>
.insta-feed-scroll {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.insta-feed-scroll::-webkit-scrollbar {
  width: 6px;
}
.insta-feed-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}
.insta-feed-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.feed-img + .feed-img {
  margin-top: 2px;
}
</style>
