All files / apps/huella-legal/app/components/base SectionHeading.vue

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

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  38x 38x       6x                                                               38x   38x 38x    
<template>
    <div
        class="flex flex-col gap-2 border-t-2 border-inverted pt-4 sm:flex-row sm:items-end sm:justify-between"
    >
        <hgroup>
            <p v-if="kicker" class="flex">
                <BaseKicker>{{ kicker }}</BaseKicker>
            </p>
            <h2
                :id="headingId"
                class="font-serif text-section text-highlighted md:text-h2"
                :class="kicker && 'mt-1'"
            >
                {{ title }}
            </h2>
        </hgroup>
        <UButton
            v-if="action"
            variant="link"
            :label="action.label"
            :to="action.to"
            :aria-describedby="headingId"
            trailing-icon="i-lucide-arrow-right"
            class="-ml-3 self-start sm:-mr-3 sm:ml-0 sm:self-auto"
        />
    </div>
</template>
 
<script setup lang="ts">
import type { LinkAction } from "~/types/LinkAction";
 
interface Props {
    title: string;
    kicker?: string;
    action?: LinkAction;
    id?: string;
}
 
const props = defineProps<Props>();
 
const fallbackId = useId();
const headingId = computed<string>(() => props.id ?? fallbackId);
</script>