2022-12-07 15:55:45 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Card } from 'masto'
|
|
|
|
|
|
|
|
const prop = defineProps<{
|
|
|
|
card: Card
|
|
|
|
}>()
|
|
|
|
const alt = $computed(() => `${prop.card.title} - ${prop.card.title}`)
|
2022-12-07 19:13:33 +00:00
|
|
|
const isSquare = $computed(() => prop.card.width === prop.card.height)
|
2022-12-07 15:55:45 +00:00
|
|
|
|
|
|
|
// TODO: handle card.type: 'photo' | 'video' | 'rich';
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
v-if="card"
|
|
|
|
border="~ base"
|
|
|
|
display-block
|
|
|
|
rounded-lg
|
|
|
|
>
|
2022-12-07 19:13:33 +00:00
|
|
|
<NuxtLink display-block :to="card.url" :class="{ flex: isSquare }">
|
2022-12-07 15:55:45 +00:00
|
|
|
<CommonBlurhash
|
|
|
|
v-if="card.image"
|
|
|
|
:blurhash="card.blurhash"
|
|
|
|
:src="card.image"
|
|
|
|
:width="card.width"
|
|
|
|
:height="card.height"
|
|
|
|
:alt="alt"
|
2022-12-07 19:13:33 +00:00
|
|
|
flex flex-col
|
2022-12-07 15:55:45 +00:00
|
|
|
display-block
|
|
|
|
rounded-lg
|
2022-12-07 19:13:33 +00:00
|
|
|
:class="isSquare ? 'rounded-r-none w-32' : 'rounded-b-none w-full'"
|
2022-12-07 15:55:45 +00:00
|
|
|
object-cover
|
|
|
|
/>
|
2022-12-07 19:13:33 +00:00
|
|
|
<div
|
|
|
|
p4 max-h-2xl
|
|
|
|
flex flex-col
|
|
|
|
>
|
2022-12-07 15:55:45 +00:00
|
|
|
<p v-if="card.providerName" text-secondary line-clamp-1 text-ellipsis>
|
|
|
|
{{ card.providerName }}
|
|
|
|
</p>
|
|
|
|
<strong v-if="card.title" line-clamp-1 text-ellipsis>{{ card.title }}</strong>
|
|
|
|
<p v-if="card.description" text-secondary line-clamp-2 text-ellipsis>
|
|
|
|
{{ card.description }}
|
|
|
|
</p>
|
|
|
|
<p v-else text-secondary line-clamp-2 text-ellipsis>
|
|
|
|
{{ card.url }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</NuxtLink>
|
|
|
|
</div>
|
|
|
|
</template>
|