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.
This commit is contained in:
1 parent
db04d441c9
commit
26739731ed
9 files changed
+321
-1
No files matched your search
@@ -0,0 +1,54 @@
|
||||
<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>
|
||||
Reference in new issue
Block a user