mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-26 11:36:20 +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">
|
<script lang="ts">
|
||||||
export let product: { ean: string; name: string; imageUrl: string };
|
export let product: { ean: string; name: string; imageUrl?: string | null };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<a href={`/ean/${product.ean}`} class="flex">
|
<a href={`/ean/${product.ean}`} class="flex">
|
||||||
<img src={product.imageUrl} alt={product.name} class="max-h-48" />
|
{#if product.imageUrl}
|
||||||
|
<img src={product.imageUrl} alt={product.name} class="max-h-48" />
|
||||||
|
{/if}
|
||||||
<p class="text-xl">{product.name}</p>
|
<p class="text-xl">{product.name}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
import type { PageData } from "./$types";
|
import type { PageData } from "./$types";
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
$: precios = data.precios.filter(
|
||||||
|
(d): d is { ean: string; name: string; imageUrl: string | null } =>
|
||||||
|
!!d.name,
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1 class="text-xl">WIP</h1>
|
<h1 class="text-xl">WIP</h1>
|
||||||
|
@ -32,7 +36,7 @@
|
||||||
<section>
|
<section>
|
||||||
<h2 class="text-lg font-bold">Random</h2>
|
<h2 class="text-lg font-bold">Random</h2>
|
||||||
<ul class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
<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>
|
<li>
|
||||||
<ProductPreview {product} />
|
<ProductPreview {product} />
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue