All files / apps/huella-legal/layers/articles/app/components/summary Grid.vue

100% Statements 6/6
100% Branches 7/7
100% Functions 2/2
100% Lines 5/5

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  7x 11x                               7x   7x 5x          
<template>
    <ul class="grid gap-x-10 gap-y-12 md:grid-cols-2 lg:grid-cols-3">
        <li
            v-for="(article, index) in articles"
            :key="article.id"
            :class="index === orphan && 'md:hidden lg:block'"
        >
            <SummaryCard :article variant="media" />
        </li>
    </ul>
</template>
 
<script setup lang="ts">
interface Props {
    articles: ArticleSummary[];
    hideOrphan?: boolean;
}
 
const props = withDefaults(defineProps<Props>(), { hideOrphan: false });
 
const orphan = computed<number>(() =>
    props.hideOrphan && props.articles.length > 1 && props.articles.length % 2 === 1
        ? props.articles.length - 1
        : -1,
);
</script>