<script setup lang="ts">
import type { Tag } from '@/models'
import TagCard from '@/components/TagCard.vue'

const props = defineProps<{
  tags: Tag[]
  onClick?: (tag: Tag) => void
}>()

function handleClick(tag: Tag) {
  if (props.onClick) {
    props.onClick(tag)
  }
}

</script>

<template>
  <div>
    <TagCard
      v-for="tag in props.tags"
      :key="tag.id"
      :target="tag"
      :on-click="() => handleClick(tag)"
    />
  </div>
</template>

<style scoped></style>
