Skip to content

Instantly share code, notes, and snippets.

@codigoconjuan
Last active July 16, 2025 14:42
Show Gist options
  • Save codigoconjuan/9c2a53bfb9ec2ea91e74af9c2a3d7794 to your computer and use it in GitHub Desktop.
Save codigoconjuan/9c2a53bfb9ec2ea91e74af9c2a3d7794 to your computer and use it in GitHub Desktop.
Panel de Administración FreshCoffee - Astro y WordPress
---
import AdminLayout from "./AdminLayout.astro";
interface Props {
title: string
}
const { title} = Astro.props;
---
<AdminLayout title={title}>
<slot name="before-products-table" />
<div class="px-4 sm:px-6 lg:px-8 mt-20 max-w-6xl mx-auto shadow-2xl">
<div class="mt-8 flow-root">
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div
class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8 bg-white p-5"
>
<table class="min-w-full divide-y divide-gray-300">
<thead>
<tr>
<th
scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"
>
Imagen
</th>
<th
scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"
>
Producto
</th>
<th
scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"
>
Categoría
</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-0">
<span class="sr-only">Acciones</span>
</th>
</tr>
</thead>
<slot />
</table>
</div>
</div>
</div>
</div>
</AdminLayout>
---
import type { Product } from '@/types'
interface Props {
products: Product[]
}
const { products } = Astro.props
---
<tbody class="divide-y divide-gray-200">
{
products.map((product) => (
<tr>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
</td>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-0">
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<a
class="bg-indigo-400 p-1 text-white rounded"
href={''}
>
</a>
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0">
</td>
</tr>
))
}
</tbody>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment