mirror of
https://github.com/ershisan99/db-studio.git
synced 2025-12-16 12:33:05 +00:00
refactor data table a bit
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
import { TableView } from "@/components/db-table-view/table";
|
import {
|
||||||
|
TableScrollContainer,
|
||||||
|
TableView,
|
||||||
|
} from "@/components/db-table-view/table";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
DataTablePagination,
|
DataTablePagination,
|
||||||
@@ -230,9 +233,9 @@ export const DataTable = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-md border min-h-0 h-full w-full min-w-0 flex flex-col">
|
<div className="rounded-md border min-h-0 h-full w-full min-w-0 flex flex-col">
|
||||||
<div className={"flex flex-col flex-1 overflow-auto relative"}>
|
<TableScrollContainer>
|
||||||
<TableView table={table} columnLength={columns.length} />
|
<TableView table={table} columnLength={columns.length} />
|
||||||
</div>
|
</TableScrollContainer>
|
||||||
</div>
|
</div>
|
||||||
<DataTablePagination table={table} />
|
<DataTablePagination table={table} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { type Table as ReactTable, flexRender } from "@tanstack/react-table";
|
import { type Table as ReactTable, flexRender } from "@tanstack/react-table";
|
||||||
import { ArrowUp } from "lucide-react";
|
import { ArrowUp } from "lucide-react";
|
||||||
|
import type { PropsWithChildren } from "react";
|
||||||
|
|
||||||
export function TableView<T>({
|
export function TableView<T>({
|
||||||
table,
|
table,
|
||||||
@@ -108,3 +109,11 @@ export function TableView<T>({
|
|||||||
</Table>
|
</Table>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function TableScrollContainer({ children }: PropsWithChildren) {
|
||||||
|
return (
|
||||||
|
<div className={"flex flex-col flex-1 overflow-auto relative"}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user