All files / apps/huella-legal/layers/reading/app/components/article Header.vue

100% Statements 20/20
100% Branches 8/8
100% Functions 8/8
100% Lines 19/19

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81  11x   4x 11x     4x       11x               11x     4x                                                     11x   11x   11x 11x 11x         11x               11x 11x     11x 11x     11x 11x      
<template>
    <ArticleTitle :breadcrumb :title="article.title">
        <template #kicker>
            <p class="mt-6 flex flex-wrap items-center gap-x-2 gap-y-1 font-sans text-xs md:mt-8">
                <BaseKicker>{{ formatLabel }}</BaseKicker>
                <template v-if="article.number">
                    <span class="text-dimmed" aria-hidden="true">ยท</span>
                    <span class="text-muted tabular-nums">
                        {{ $t("article.number", { number: article.number }) }}
                    </span>
                </template>
            </p>
        </template>
 
        <p
            v-if="article.excerpt"
            class="mt-6 max-w-measure border-y border-default py-5 font-serif text-standfirst text-toned italic md:text-standfirst-lg"
        >
            {{ article.excerpt }}
        </p>
 
        <div
            class="mt-5 flex max-w-measure flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"
        >
            <ArticleByline
                :authors="bylineAuthors"
                :published-at="article.publishedAt"
                :reading-minutes="article.readingMinutes"
                :comments
                avatars
            />
            <ArticleShareBar
                :title="article.title"
                :url="article.permalink"
                :cite-to="{ hash: '#citar' }"
                class="-ml-3 sm:-mr-3 sm:ml-0"
            />
        </div>
    </ArticleTitle>
</template>
 
<script setup lang="ts">
import type { BreadcrumbItem } from "@nuxt/ui";
 
interface Props {
    article: Article;
    commentCount?: number;
}
 
const props = defineProps<Props>();
 
const { t } = useI18n();
 
const breadcrumb = computed<BreadcrumbItem[]>(() => {
    const { category } = props.article;
    const items: BreadcrumbItem[] = [
        { label: t("article.breadcrumb.home"), to: { name: "index" } },
        { label: t("article.breadcrumb.publications"), to: { name: "publications" } },
    ];
 
    return category
        ? [
              ...items,
              { label: category.name, to: { name: "category", params: { slug: category.slug } } },
          ]
        : items;
});
 
const formatLabel = computed<string>(() =>
    t(`article.formats.${FORMAT_KEYS[props.article.format]}`),
);
 
const comments = computed(() =>
    props.commentCount ? { count: props.commentCount, to: { hash: "#comentarios" } } : undefined,
);
 
const bylineAuthors = computed(() =>
    props.article.authors.map((author) => ({ ...author, to: { hash: "#autor" } })),
);
</script>