<!-- Адаптивная сетка карточек категорий (auto-fill) -->
<template>
  <div class="grid-categories">
    <CardCategory
      v-for="(item, index) in categories"
      :key="item.guid"
      :card="item"
      :priority="priority && index === 0"
    />
    <slot/>
  </div>
</template>

<script setup lang="ts">
import type { ICategoryCard } from '../../types';

defineProps<{
  categories: Array<ICategoryCard>,
  priority?: boolean
}>();
</script>

<style lang="scss">
.grid-categories {
  --min-width: 150px;

  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--min-width), 1fr));

  @include from-br(sm) {
    --min-width: 250px;

    gap: 16px;
  }
}
</style>
