mirror of
https://github.com/catdevnull/preciazo.git
synced 2025-02-17 00:44:09 +00:00
product preview en index
This commit is contained in:
parent
f20203cac8
commit
d59b4283bc
2 changed files with 8 additions and 5 deletions
|
@ -6,7 +6,11 @@ import { sql } from "drizzle-orm";
|
|||
|
||||
export const load: PageServerLoad = async ({ params }) => {
|
||||
const q = db
|
||||
.select({ ean: precios.ean, name: precios.name })
|
||||
.select({
|
||||
ean: precios.ean,
|
||||
name: precios.name,
|
||||
imageUrl: precios.imageUrl,
|
||||
})
|
||||
.from(precios)
|
||||
.groupBy(precios.ean)
|
||||
.having(sql`max(length(name))`)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script lang="ts">
|
||||
import ProductPreview from "$lib/ProductPreview.svelte";
|
||||
import type { PageData } from "./$types";
|
||||
|
||||
export let data: PageData;
|
||||
|
@ -30,12 +31,10 @@
|
|||
|
||||
<section>
|
||||
<h2 class="text-lg font-bold">Random</h2>
|
||||
<ul>
|
||||
<ul class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{#each data.precios as product}
|
||||
<li>
|
||||
<a href={`/ean/${product.ean}`}>
|
||||
{product.name}
|
||||
</a>
|
||||
<ProductPreview {product} />
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue