109 lines
2.3 KiB
Vue
109 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
defineProps<{
|
|
image: string
|
|
name: string
|
|
intro: string
|
|
url?: string
|
|
officialWebsiteLabel?: string
|
|
}>()
|
|
</script>
|
|
|
|
<template>
|
|
<article class="hcard">
|
|
<div class="hcard__media">
|
|
<img :src="image" :alt="name" />
|
|
<div class="hcard__name">{{ name }}</div>
|
|
<div class="hcard__panel">
|
|
<h3 class="hcard__panel-name">{{ name }}</h3>
|
|
<p class="hcard__intro">{{ intro }}</p>
|
|
<a v-if="url" :href="url" target="_blank" rel="noopener" class="hcard__link" @click.stop>
|
|
{{ officialWebsiteLabel ?? 'Official website →' }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.hcard {
|
|
border-radius: var(--radius);
|
|
overflow: hidden;
|
|
box-shadow: var(--shadow);
|
|
background: #fff;
|
|
}
|
|
.hcard__media {
|
|
position: relative;
|
|
aspect-ratio: 495 / 365;
|
|
overflow: hidden;
|
|
}
|
|
.hcard__media img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
}
|
|
.hcard__name {
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, .47);
|
|
color: #fff;
|
|
font-size: 24px;
|
|
font-weight: 700;
|
|
padding: 12px 18px;
|
|
}
|
|
.hcard__panel {
|
|
position: absolute;
|
|
inset: 0;
|
|
background: rgba(72, 164, 252, .96);
|
|
color: #fff;
|
|
padding: 26px 24px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
opacity: 0;
|
|
transform: translateY(8px);
|
|
transition: opacity .28s ease, transform .28s ease;
|
|
overflow: auto;
|
|
scrollbar-width: thin;
|
|
scrollbar-color: rgba(255, 255, 255, 0.45) transparent;
|
|
}
|
|
|
|
.hcard__panel::-webkit-scrollbar {
|
|
width: 5px;
|
|
}
|
|
|
|
.hcard__panel::-webkit-scrollbar-button {
|
|
display: none;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
.hcard__panel::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
.hcard__panel::-webkit-scrollbar-thumb {
|
|
background: rgba(255, 255, 255, 0.4);
|
|
border-radius: 999px;
|
|
}
|
|
|
|
.hcard__panel::-webkit-scrollbar-thumb:hover {
|
|
background: rgba(255, 255, 255, 0.6);
|
|
}
|
|
.hcard:hover .hcard__panel,
|
|
.hcard:focus-within .hcard__panel {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
.hcard__panel-name { font-size: 22px; font-weight: 800; }
|
|
.hcard__intro { font-size: 15px; line-height: 1.7; white-space: pre-line; }
|
|
.hcard__link {
|
|
margin-top: auto;
|
|
font-size: 14px;
|
|
word-break: break-all;
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|