All files / apps/portfolio/app/components/work List.vue

100% Statements 14/14
88.23% Branches 15/17
100% Functions 7/7
100% Lines 13/13

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  9x   7x   9x 7x 20x                                 7x                 7x 7x           4x     20x                       9x   9x 20x                            
<template>
    <section id="work" class="bg-muted">
        <UContainer class="py-20">
            <h2 class="font-display text-section text-highlighted md:text-title">
                {{ $t("workList.title") }} <mark>{{ $t("workList.titleMark") }}</mark>
            </h2>
            <div class="mt-12 grid gap-x-10 gap-y-12 md:grid-cols-3">
                <article
                    v-for="item in items"
                    :key="item.slug"
                    class="flex flex-col gap-3"
                    :class="item.shot && 'md:col-span-3 md:grid md:grid-cols-3 md:gap-x-10'"
                >
                    <img
                        v-if="item.shot"
                        v-bind="item.shot"
                        sizes="(min-width: 48rem) 66vw, 100vw"
                        loading="lazy"
                        :alt="item.shotAlt"
                        :style="carried(`work-shot-${item.slug}`)"
                        width="1440"
                        height="900"
                        class="w-full border border-default md:col-span-2 md:row-span-6"
                    />
                    <p class="font-mono text-xs text-muted uppercase">
                        {{ item.kind }} ยท {{ item.stage }}
                    </p>
                    <h3
                        class="font-display text-heading text-highlighted"
                        :style="carried(`work-title-${item.slug}`)"
                    >
                        {{ item.name }}
                    </h3>
                    <p class="text-base">{{ item.what }}</p>
                    <div class="flex flex-wrap gap-x-6 gap-y-1 text-sm">
                        <ULink
                            v-if="item.story"
                            :to="item.story"
                            class="text-primary underline underline-offset-4"
                        >
                            {{ $t("workList.caseStudy") }}
                        </ULink>
                        <ULink :to="item.href" class="underline underline-offset-4">
                            {{ item.cta }}
                        </ULink>
                    </div>
                </article>
            </div>
        </UContainer>
    </section>
</template>
 
<script setup lang="ts">
import { isStudy } from "~/utils/work";
 
const { data: work } = await useWorkList();
 
const items = computed(() =>
    work.value.map((entry, index) => ({
        slug: entry.slug,
        name: entry.name,
        kind: entry.kind,
        what: entry.line,
        stage: entry.stage,
        story: entry.caseStudy ? `/work/${entry.slug}` : null,
        cta: entry.live.label,
        href: portalUrl(entry.live.href),
        shot: index === 0 && isStudy(entry) ? workScreenshot(entry) : undefined,
        shotAlt: isStudy(entry) ? entry.screenshot.alt : "",
    })),
);
</script>