Files
CV_Site_Nuxt/app/components/home/ContactItem.vue
T
Noel Sabia 26739731ed feat(ui): build homepage hero, terminal and feature cards
Compose pages/index.vue from the desktop homepage mockup: decorative
backdrop scoped to the hero but not clipped at its bottom edge, hero with
status pill, quote and contact chips with copy buttons, terminal panel fed
by a chapter array with derived counters, and the three feature cards.

Split into app/components/home/ (auto-imported with the Home* prefix) and
keep the chapter data in app/data/chapters.ts so GET /api/chapters can
replace the mockup values later.
2026-10-23 21:22:02 +02:00

55 lines
1.7 KiB
Vue

<script setup lang="ts">
const props = defineProps<{
icon: string
value: string
/** Omit for a plain chip (no copy button). */
copyValue?: string
}>()
const copied = ref(false)
let resetTimer: ReturnType<typeof setTimeout> | undefined
async function copy() {
if (!props.copyValue) return
try {
await navigator.clipboard.writeText(props.copyValue)
copied.value = true
clearTimeout(resetTimer)
resetTimer = setTimeout(() => {
copied.value = false
}, 1800)
} catch {
// Clipboard permission denied: leave the label on COPY.
}
}
onBeforeUnmount(() => clearTimeout(resetTimer))
</script>
<template>
<div
class="flex items-center gap-2 rounded-lg bg-surface-container-low/70 px-3 py-2"
:class="copyValue
? 'justify-between transition-colors hover:bg-surface-container-high'
: 'justify-center font-body-sm text-body-sm text-on-surface-variant'"
>
<div class="flex min-w-0 items-center gap-2.5">
<span class="material-symbols-outlined text-[1.125rem] text-outline">{{ icon }}</span>
<span
v-if="copyValue"
class="select-all truncate font-body-sm text-body-sm text-on-surface"
>{{ value }}</span>
<span v-else class="whitespace-nowrap text-on-surface">{{ value }}</span>
</div>
<button
v-if="copyValue"
type="button"
class="flex items-center gap-1 rounded bg-surface-variant px-2 py-1 text-[0.625rem] font-semibold tracking-wider text-on-surface-variant transition-colors hover:text-on-surface active:scale-95"
:aria-label="`Copy ${value}`"
@click="copy"
>
<span>{{ copied ? 'COPIED' : 'COPY' }}</span>
</button>
</div>
</template>