This is an automated email from the ASF dual-hosted git repository. mintsweet pushed a commit to branch fix-5853 in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 835efb3d58de06a75500c5459eefd71f484c3604 Author: mintsweet <[email protected]> AuthorDate: Tue Aug 15 20:55:22 2023 +1200 feat(config-ui): support pagination in table --- config-ui/src/components/table/table.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/config-ui/src/components/table/table.tsx b/config-ui/src/components/table/table.tsx index 2f8e2fdf7..b55b6021b 100644 --- a/config-ui/src/components/table/table.tsx +++ b/config-ui/src/components/table/table.tsx @@ -16,6 +16,9 @@ * */ +import type { PaginationProps } from '../pagination'; +import { Pagination } from '../pagination'; + import type { TableContentProps } from './components'; import { TableLoading, TableNoData, TableContent } from './components'; @@ -26,9 +29,16 @@ interface Props<T> extends TableContentProps<T> { btnText?: string; onCreate?: () => void; }; + pagination?: PaginationProps; } -export const Table = <T extends Record<string, any>>({ loading, dataSource, noData = {}, ...props }: Props<T>) => { +export const Table = <T extends Record<string, any>>({ + loading, + dataSource, + noData = {}, + pagination, + ...props +}: Props<T>) => { if (loading) { return <TableLoading />; } @@ -37,5 +47,10 @@ export const Table = <T extends Record<string, any>>({ loading, dataSource, noDa return <TableNoData {...noData} />; } - return <TableContent dataSource={dataSource} {...props} />; + return ( + <> + <TableContent dataSource={dataSource} {...props} /> + {pagination && <Pagination {...pagination} />} + </> + ); };
