mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 22:26:19 +00:00
arreglar types productpreview
This commit is contained in:
parent
16a51e41b1
commit
f089ff5047
2 changed files with 9 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
|||
<script lang="ts">
|
||||
export let product: { ean: string; name: string; imageUrl: string };
|
||||
export let product: { ean: string; name: string; imageUrl?: string | null };
|
||||
</script>
|
||||
|
||||
<a href={`/ean/${product.ean}`} class="flex">
|
||||
{#if product.imageUrl}
|
||||
<img src={product.imageUrl} alt={product.name} class="max-h-48" />
|
||||
{/if}
|
||||
<p class="text-xl">{product.name}</p>
|
||||
</a>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
import type { PageData } from "./$types";
|
||||
|
||||
export let data: PageData;
|
||||
$: precios = data.precios.filter(
|
||||
(d): d is { ean: string; name: string; imageUrl: string | null } =>
|
||||
!!d.name,
|
||||
);
|
||||
</script>
|
||||
|
||||
<h1 class="text-xl">WIP</h1>
|
||||
|
@ -32,7 +36,7 @@
|
|||
<section>
|
||||
<h2 class="text-lg font-bold">Random</h2>
|
||||
<ul class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{#each data.precios as product}
|
||||
{#each precios as product}
|
||||
<li>
|
||||
<ProductPreview {product} />
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue