inhaus-plugin-verleih/resources/js/components/ItemCard.vue
Friederich Loheide dce39774a2 Vorschau zeigt immer das ganze Bild, eingepasst mit Rand (1.0.1)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:39:16 +00:00

26 lines
1.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import { Link } from '@inertiajs/vue3';
import { ImageOff, MapPin } from '@lucide/vue';
import StatusBadge from './StatusBadge.vue';
defineProps({
item: { type: Object, required: true },
});
</script>
<template>
<article class="ih:group ih:flex ih:flex-col ih:overflow-hidden ih:rounded-lg ih:border ih:bg-card ih:shadow-xs ih:transition-shadow ih:hover:shadow-md">
<!-- Immer das ganze Bild: in die Fläche eingepasst, mit Rand – nie ein Ausschnitt -->
<Link :href="item.url" prefetch class="ih:relative ih:block ih:aspect-[4/3] ih:overflow-hidden ih:bg-muted ih:p-3 ih:pt-9">
<img v-if="item.thumb_url" :src="item.thumb_url" :alt="item.title" loading="lazy" class="ih:size-full ih:object-contain ih:transition-transform ih:duration-300 ih:group-hover:scale-[1.02]" />
<span v-else class="ih:grid ih:size-full ih:place-items-center"><ImageOff class="ih:size-8 ih:text-muted-foreground" :stroke-width="1.5" /></span>
<StatusBadge :lent="item.lent" class="ih:absolute ih:top-2 ih:left-2" />
</Link>
<div class="ih:flex ih:flex-1 ih:flex-col ih:gap-1 ih:p-3">
<Link :href="item.url" prefetch class="ih:line-clamp-2 ih:text-[15px] ih:leading-snug ih:font-semibold ih:hover:underline">{{ item.title }}</Link>
<p v-if="item.location" class="ih:mt-auto ih:flex ih:items-center ih:gap-1 ih:pt-1 ih:text-xs ih:text-muted-foreground">
<MapPin class="ih:size-3.5 ih:shrink-0" /><span class="ih:truncate">{{ item.location }}</span>
</p>
</div>
</article>
</template>