added ability to make tables

This commit is contained in:
2026-05-23 19:50:08 +01:00
parent 7a76412a3f
commit 5f4436180e

36
src/routes/Table.svelte Normal file
View File

@@ -0,0 +1,36 @@
<script>
let { data, header, row } = $props();
</script>
<table class="w-full table-fixed">
{#if header}
<thead>
<tr>{@render header()}</tr>
</thead>
{/if}
<tbody>
{#each data as d}
<tr>{@render row(d)}</tr>
{/each}
</tbody>
</table>
<style>
table {
text-align: left;
border-spacing: 0;
padding: 0;
margin: 0;
}
tbody tr:nth-child(2n + 1) {
background: blue;
}
table :global(th),
table :global(td) {
padding: 0;
margin: 0;
}
</style>