fix(ui): display hostname instead of full url (#376)

zio/stable
Ayo Ayco 2022-12-08 15:57:52 +01:00 committed by GitHub
parent 49a28144fd
commit 468592f59a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -6,6 +6,7 @@ const prop = defineProps<{
}>() }>()
const alt = $computed(() => `${prop.card.title} - ${prop.card.title}`) const alt = $computed(() => `${prop.card.title} - ${prop.card.title}`)
const isSquare = $computed(() => prop.card.width === prop.card.height) const isSquare = $computed(() => prop.card.width === prop.card.height)
const description = $computed(() => prop.card.description ? prop.card.description : new URL(prop.card.url).hostname)
// TODO: handle card.type: 'photo' | 'video' | 'rich'; // TODO: handle card.type: 'photo' | 'video' | 'rich';
</script> </script>
@ -39,11 +40,8 @@ const isSquare = $computed(() => prop.card.width === prop.card.height)
{{ card.providerName }} {{ card.providerName }}
</p> </p>
<strong v-if="card.title" line-clamp-1 text-ellipsis>{{ card.title }}</strong> <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> <p v-if="description" text-secondary line-clamp-2 text-ellipsis>
{{ card.description }} {{ description }}
</p>
<p v-else text-secondary line-clamp-2 text-ellipsis>
{{ card.url }}
</p> </p>
</div> </div>
</NuxtLink> </NuxtLink>