46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
---
|
|
import Layout from '../layouts/Main.astro';
|
|
|
|
//import { eq } from 'drizzle-orm';
|
|
import { db } from '../db';
|
|
//import * as schema from '../db/schema.ts';
|
|
|
|
|
|
// Get some sample Pokemon data from the database
|
|
//const pokemon = await db.select().from(schema.cards).where(eq(schema.cards.productLineName, "pokemon")).limit(16);
|
|
const pokemon = await db.query.cards.findMany({
|
|
where: { productLineName: "pokemon" },
|
|
limit: 16,
|
|
with: {
|
|
prices: true,
|
|
}
|
|
});
|
|
---
|
|
|
|
<Layout>
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<h1>Pokemon</h1>
|
|
</div>
|
|
</div>
|
|
<div class="row gy-4 row-cols-1 row-cols-md-2 row-cols-lg-3 row-cols-xl-4">
|
|
{pokemon.map((card) => (
|
|
<div class="col">
|
|
<img src={`/cards/${card.productId}.jpg`} alt={card.productName} class="img-fluid" />
|
|
<div class="row justify-content-between">
|
|
<div class="col-auto"><strong>{card.productName}</strong></div>
|
|
<div class="col-auto">{card.number}</div>
|
|
</div>
|
|
<div class="row">
|
|
{card.prices.map((price) => (
|
|
<div class="col-auto copy-small">{price.condition.split(' ').map((word) => word.charAt(0)).join('')}<br />{price.marketPrice}</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
))}
|
|
|
|
</div>
|
|
</div>
|
|
</Layout>
|