Files
pokemon/src/pages/pokemon.astro

46 lines
1.4 KiB
Plaintext
Raw Normal View History

2026-02-12 23:27:13 -05:00
---
import Layout from '../layouts/Main.astro';
//import { eq } from 'drizzle-orm';
2026-02-12 23:27:13 -05:00
import { db } from '../db';
//import * as schema from '../db/schema.ts';
2026-02-12 23:27:13 -05:00
// 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,
}
});
2026-02-12 23:27:13 -05:00
---
<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">
2026-02-12 23:27:13 -05:00
{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>
2026-02-12 23:27:13 -05:00
</div>
))}
</div>
</div>
</Layout>