Contact bar: Gmail, Heilbronn and a LinkedIn link; the phone chip is removed. Hero: System Architect / Programmer, new pill and quote. Feature cards: humility, learning and helpfulness instead of the infrastructure copy. Terminal: six chapters from the LinkedIn export (PreZero active; Defifort, Alignerr, Outlier, freelance and 42 finished), each with a context label. Rows use a fixed grid so names, context badges, status, uptime and outcome line up vertically; the title bar has red/yellow/green traffic lights and the footer pluralises its counters (1/5/14). OKF: new profile data document for the export and chapter mapping; backend endpoint examples and totals match the real rows.
71 lines
2.4 KiB
Vue
71 lines
2.4 KiB
Vue
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
icon: string
|
|
value: string
|
|
/** Omit for a plain chip (no copy button). */
|
|
copyValue?: string
|
|
/** Renders the chip as an external link instead of a copy chip. */
|
|
href?: string
|
|
}>()
|
|
|
|
const isLink = computed(() => Boolean(props.href))
|
|
|
|
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>
|
|
<component
|
|
:is="isLink ? 'a' : 'div'"
|
|
:href="isLink ? href : undefined"
|
|
:target="isLink ? '_blank' : undefined"
|
|
:rel="isLink ? 'noopener noreferrer' : undefined"
|
|
:aria-label="isLink ? `Open ${value} in a new tab` : undefined"
|
|
class="flex items-center gap-2 rounded-lg bg-surface-container-low/70 px-3 py-2"
|
|
:class="isLink
|
|
? 'group justify-between gap-3 transition-colors hover:bg-surface-container-high'
|
|
: 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 || isLink"
|
|
class="truncate font-body-sm text-body-sm text-on-surface"
|
|
:class="copyValue && !isLink ? 'select-all' : ''"
|
|
>{{ value }}</span>
|
|
<span v-else class="whitespace-nowrap text-on-surface">{{ value }}</span>
|
|
</div>
|
|
<button
|
|
v-if="copyValue && !isLink"
|
|
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>
|
|
<span
|
|
v-else-if="isLink"
|
|
class="material-symbols-outlined text-[0.875rem] text-outline transition-colors group-hover:text-on-surface"
|
|
>open_in_new</span>
|
|
</component>
|
|
</template>
|