All files / apps/huella-legal/layers/archive/app/components/subjects Topics.vue

100% Statements 13/13
100% Branches 0/0
100% Functions 6/6
100% Lines 11/11

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 51 52 53 54 55 56 57  3x     3x 2x     2x 6x                         9x           2x   9x           2x                               3x   9x    
<template>
    <UContainer as="section" aria-labelledby="temas" class="py-16 lg:py-20">
        <h2 id="temas" class="scroll-mt-6 text-kicker">
            {{ $t("subjectsTopics.title") }}
        </h2>
        <p class="mt-2 max-w-measure font-serif text-base/relaxed text-pretty text-toned">
            {{ $t("subjectsTopics.lead") }}
        </p>
        <div class="mt-6 gap-x-10 sm:columns-2 lg:columns-4">
            <section
                v-for="[letter, group] in letters"
                :key="letter"
                :aria-label="$t('subjectsTopics.letter', { letter })"
                class="mb-6 break-inside-avoid last:mb-0"
            >
                <p
                    class="border-b border-default pb-1 font-serif text-2xl text-secondary"
                    aria-hidden="true"
                >
                    {{ letter }}
                </p>
                <ul>
                    <li v-for="{ value, count } in group" :key="value.id">
                        <ULink
                            raw
                            :to="{ name: 'tag', params: { slug: value.slug } }"
                            class="group flex min-h-11 items-center justify-between gap-3 font-serif text-base text-highlighted focus-visible:rounded-xs"
                        >
                            <span class="underline-title group-hover:underline">{{
                                value.name
                            }}</span>
                            <span
                                class="font-sans text-meta text-muted tabular-nums"
                                aria-hidden="true"
                                >{{ count }}</span
                            >
                            <span class="sr-only">{{
                                $t("subjectsTopics.count", { count }, count)
                            }}</span>
                        </ULink>
                    </li>
                </ul>
            </section>
        </div>
    </UContainer>
</template>
 
<script setup lang="ts">
interface Props {
    topics: Facet<Category>[];
}
 
const props = defineProps<Props>();
 
const letters = computed(() => groupByLetter(props.topics, ({ value }) => value.name));
</script>