All files / src/entities/catalog/ui ProductGrid.vue

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50                            5x 6x                                                                    
<script setup lang="ts">
import type { ProductSummary } from "@plain-journal/foundation";
 
import ProductCard from "./ProductCard.vue";
 
withDefaults(defineProps<{
  products: ProductSummary[];
  headingLevel?: 2 | 3;
}>(), {
  headingLevel: 3,
});
</script>
 
<template>
  <div class="product-grid">
    <ProductCard
      v-for="product in products"
      :key="product.id"
      :product="product"
      :heading-level="headingLevel"
    />
  </div>
</template>
 
<style scoped>
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 4.5rem) clamp(1rem, 2vw, 2rem);
}
 
@media (max-width: 64rem) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
 
@media (max-width: 48rem) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
 
@media (max-width: 32rem) {
  .product-grid {
    gap: var(--pj-space-7) var(--pj-space-3);
  }
}
</style>