Skip to content

Commit 2327ad0

Browse files
committed
Use common table code
1 parent 8eea6fd commit 2327ad0

File tree

3 files changed

+4
-55
lines changed

3 files changed

+4
-55
lines changed

src/routes/(authenticated)/sharelinks/columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ColumnDef, StringOrTemplateHeader } from '@tanstack/table-core';
22
import { createRawSnippet } from 'svelte';
33
import { renderComponent, renderSnippet } from '$lib/components/ui/data-table';
4-
import DataTableSortButton from './data-table-sort-button.svelte';
4+
import DataTableSortButton from '$lib/components/Table/SortButton.svelte';
55
import DataTableActions from './data-table-actions.svelte';
66

77
export type ShareLink = {

src/routes/(authenticated)/sharelinks/data-table-sort-button.svelte

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" generics="TData, TValue">
2-
import { createSvelteTable, FlexRender } from '$lib/components/ui/data-table';
3-
import * as Table from '$lib/components/ui/table';
2+
import { createSvelteTable } from '$lib/components/ui/data-table';
3+
import Table from '$lib/components/Table/TableTemplate.svelte';
44
import {
55
getCoreRowModel,
66
getFilteredRowModel,
@@ -39,40 +39,4 @@
3939
});
4040
</script>
4141

42-
<div>
43-
<div class="rounded-md border">
44-
<Table.Root>
45-
<Table.Header>
46-
{#each table.getHeaderGroups() as headerGroup (headerGroup.id)}
47-
<Table.Row>
48-
{#each headerGroup.headers as header (header.id)}
49-
<Table.Head>
50-
{#if !header.isPlaceholder}
51-
<FlexRender
52-
content={header.column.columnDef.header}
53-
context={header.getContext()}
54-
/>
55-
{/if}
56-
</Table.Head>
57-
{/each}
58-
</Table.Row>
59-
{/each}
60-
</Table.Header>
61-
<Table.Body>
62-
{#each table.getRowModel().rows as row (row.id)}
63-
<Table.Row data-state={row.getIsSelected() && 'selected'}>
64-
{#each row.getVisibleCells() as cell (cell.id)}
65-
<Table.Cell>
66-
<FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
67-
</Table.Cell>
68-
{/each}
69-
</Table.Row>
70-
{:else}
71-
<Table.Row>
72-
<Table.Cell colspan={columns.length} class="h-24 text-center">No results.</Table.Cell>
73-
</Table.Row>
74-
{/each}
75-
</Table.Body>
76-
</Table.Root>
77-
</div>
78-
</div>
42+
<Table {table} {columns} />

0 commit comments

Comments
 (0)