Files
caperren-com/src/components/Table.astro
Corwin Perren 4a59e44716
Some checks failed
Build and Test - Staging / test (pull_request) Failing after 2m35s
Build and Test - Staging / build_and_push (pull_request) Has been skipped
Build and Test - Staging / deploy_staging (pull_request) Has been skipped
Started refactoring, added prettier and checks and reformatted project, added cspell and checks and custom project words, beginning of robotic oceanographic surface sampler content
2025-11-30 15:48:36 -08:00

41 lines
1.1 KiB
Plaintext

---
import type { tableData } from "@interfaces/table.ts";
const data: tableData = Astro.props.data;
const columnPadding: number = data.columnPadding || 2;
const rowPadding: number = data.columnPadding || 2;
const paddingClasses: string = `px-${columnPadding} py-${rowPadding}`;
---
<div class="relative max-w-full overflow-x-auto">
<table class="text-left text-sm">
<thead class="border-caperren-green border-b-3 bg-black text-xs uppercase">
<tr>
{
data.header.map((headingText) => (
<th scope="col" class={paddingClasses}>
{headingText}
</th>
))
}
</tr>
</thead>
<tbody>
{
data.rows.map((row) => (
<tr class="border-caperren-green border-b dark:bg-black">
{row.map((rowColumnText) => (
<th
scope="row"
class={paddingClasses + " font-medium whitespace-nowrap"}
>
{rowColumnText}
</th>
))}
</tr>
))
}
</tbody>
</table>
</div>