All files / apps/huella-legal/layers/archive/app/components/about Intro.vue

100% Statements 16/16
100% Branches 0/0
100% Functions 5/5
100% Lines 14/14

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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134  5x 2x 2x 5x               5x     2x     2x 10x           2x       2x                   2x       5x                   5x   5x                                                                                                                                                            
<template>
    <BasePageIntro :breadcrumbs="[{ label: $t('aboutIntro.breadcrumb') }]">
        <div class="grid grid-cols-1 items-center gap-8 lg:grid-cols-12 lg:gap-x-12">
            <div class="lg:col-span-7">
                <BaseKicker>{{ $t("aboutIntro.kicker") }}</BaseKicker>
                <I18nT
                    keypath="aboutIntro.title"
                    tag="h1"
                    scope="global"
                    class="mt-3 font-serif text-title text-balance text-highlighted md:text-title-xl"
                >
                    <template #mark>
                        <em class="text-secondary">{{ $t("aboutIntro.mark") }}</em>
                    </template>
                </I18nT>
                <p class="mt-6 max-w-measure font-serif text-standfirst text-pretty text-toned">
                    {{ $t("aboutIntro.lead") }}
                </p>
                <dl class="mt-8 flex max-w-measure gap-10 border-t border-default pt-6 md:gap-16">
                    <div
                        v-for="(figure, index) in figures"
                        :key="figure.key"
                        class="flex flex-col-reverse gap-1.5"
                        :style="{ '--step': index }"
                    >
                        <dt class="font-sans text-meta text-muted">
                            {{ $t(`aboutFigures.${figure.key}`) }}
                        </dt>
                        <dd
                            class="font-serif text-figure-lg text-highlighted tabular-nums md:text-figure-xl"
                        >
                            <span class="hl-about-count" :style="{ '--about-to': figure.value }"
                                ><span>{{ figure.value }}</span></span
                            >
                        </dd>
                    </div>
                </dl>
            </div>
            <div
                class="hl-about-seal relative order-first grid size-28 place-items-center rounded-full bg-muted ring-1 ring-default md:size-40 lg:order-0 lg:col-span-5 lg:size-80 lg:justify-self-end"
            >
                <AboutFingerprint class="size-16 text-secondary md:size-24 lg:size-48" />
            </div>
        </div>
    </BasePageIntro>
</template>
 
<script setup lang="ts">
interface Props {
    articles: number;
    authors: number;
}
 
const props = defineProps<Props>();
 
const figures = computed(() => [
    { key: "articles", value: props.articles },
    { key: "authors", value: props.authors },
]);
</script>
 
<style>
@property --about-n {
    syntax: "<integer>";
    inherits: false;
    initial-value: 0;
}
 
.hl-about-count {
    display: inline-grid;
}
 
.hl-about-count > span,
.hl-about-count::after {
    grid-area: 1 / 1;
}
 
@media (prefers-reduced-motion: no-preference) {
    /* WebKit animates --about-n but never repaints the counter, leaving it stuck over the digits */
    @supports not (font: -apple-system-body) {
        /* The digits stay in the DOM for screen readers and hold the width while the count runs */
        .hl-about-count > span {
            color: transparent;
        }
 
        .hl-about-count::after {
            content: counter(about-n) / "";
            counter-reset: about-n var(--about-n);
            justify-self: end;
            animation: hl-about-count 2s cubic-bezier(0.16, 1, 0.3, 1) both;
            animation-delay: calc(var(--step) * 150ms + 300ms);
        }
    }
 
    /* WCAG 2.2.2 allows unstoppable motion only under five seconds */
    .hl-about-seal::before {
        content: "";
        position: absolute;
        inset: 0;
        border: 1px solid var(--color-huella-teal-400);
        border-radius: inherit;
        opacity: 0;
        animation: hl-about-ripple 1.6s ease-out 1.8s 2;
    }
}
 
/* Forced colours repaint the transparent digits, which would then sit under the counter */
@media (forced-colors: active) {
    .hl-about-count::after {
        content: none;
    }
}
 
@keyframes hl-about-count {
    from {
        --about-n: 0;
    }
    to {
        --about-n: var(--about-to);
    }
}
 
@keyframes hl-about-ripple {
    from {
        opacity: 0.8;
    }
 
    to {
        opacity: 0;
        scale: 1.3;
    }
}
</style>