feat(products): display product image in ProductCard
This commit is contained in:
parent
798f170989
commit
bd3988ce1d
1 changed files with 11 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import type { Product } from '@/api/types';
|
||||
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from '../ui/card';
|
||||
import { imageUrl } from '@/api/image';
|
||||
|
||||
defineProps<{
|
||||
item: Product
|
||||
|
|
@ -9,7 +10,15 @@ defineProps<{
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Card variant="soft">
|
||||
<Card variant="soft" class="py-0 overflow-auto">
|
||||
<img
|
||||
v-if="item.thumbnail_url"
|
||||
:src="imageUrl(item.thumbnail_url)"
|
||||
:alt="item.name"
|
||||
class="h-48 w-full object-cover"
|
||||
loading="lazy"
|
||||
>
|
||||
|
||||
<CardHeader>
|
||||
<CardTitle>{{ item.name }}</CardTitle>
|
||||
<CardDescription>${{ item.price }} - {{ item.stock_quantity }} st</CardDescription>
|
||||
|
|
@ -18,7 +27,7 @@ defineProps<{
|
|||
</CardAction>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent>
|
||||
<CardContent class="pb-6">
|
||||
{{ item.description }}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue