refactor: remove withDefaults
macro and clean up reactive props destructuring (#3217)
This commit is contained in:
parent
7d9712c209
commit
60b1d0224c
52 changed files with 177 additions and 232 deletions
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import type { mastodon } from 'masto'
|
||||
|
||||
const props = defineProps<{
|
||||
const { card, smallPictureOnly } = defineProps<{
|
||||
card: mastodon.v1.PreviewCard
|
||||
/** For the preview image, only the small image mode is displayed */
|
||||
smallPictureOnly?: boolean
|
||||
|
@ -12,14 +12,14 @@ const props = defineProps<{
|
|||
// mastodon's default max og image width
|
||||
const ogImageWidth = 400
|
||||
|
||||
const alt = computed(() => `${props.card.title} - ${props.card.title}`)
|
||||
const alt = computed(() => `${card.title} - ${card.title}`)
|
||||
const isSquare = computed(() => (
|
||||
props.smallPictureOnly
|
||||
|| props.card.width === props.card.height
|
||||
|| Number(props.card.width || 0) < ogImageWidth
|
||||
|| Number(props.card.height || 0) < ogImageWidth / 2
|
||||
smallPictureOnly
|
||||
|| card.width === card.height
|
||||
|| Number(card.width || 0) < ogImageWidth
|
||||
|| Number(card.height || 0) < ogImageWidth / 2
|
||||
))
|
||||
const providerName = computed(() => props.card.providerName ? props.card.providerName : new URL(props.card.url).hostname)
|
||||
const providerName = computed(() => card.providerName ? card.providerName : new URL(card.url).hostname)
|
||||
|
||||
// TODO: handle card.type: 'photo' | 'video' | 'rich';
|
||||
const cardTypeIconMap: Record<mastodon.v1.PreviewCardType, string> = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue