From 8622c3dafb1bf60e5a9f76c5f511f09331eec781 Mon Sep 17 00:00:00 2001 From: Maxim Dietz Date: Mon, 4 Nov 2024 17:44:40 -0500 Subject: [PATCH] fix: Provide `isSearchable` prop to paginated table (#48251) --- web/packages/design/src/DataTable/Table.tsx | 36 ++++++++++++--------- web/packages/design/src/DataTable/types.ts | 1 + 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/web/packages/design/src/DataTable/Table.tsx b/web/packages/design/src/DataTable/Table.tsx index d028e1b18a844..62739d25b0951 100644 --- a/web/packages/design/src/DataTable/Table.tsx +++ b/web/packages/design/src/DataTable/Table.tsx @@ -188,6 +188,7 @@ export default function Table(props: TableProps) { searchValue: state.searchValue, setSearchValue, fetching, + isSearchable, }; if (state.pagination.CustomTable) { @@ -279,6 +280,7 @@ function PagedTable({ fetching, className, style, + isSearchable, }: PagedTableProps) { const { pagerPosition, paginatedData, currentPage } = pagination; const { showBothPager, showBottomPager, showTopPager } = getPagerPosition( @@ -288,21 +290,25 @@ function PagedTable({ return ( <> - - - {(showTopPager || showBothPager) && ( - - )} - + {(isSearchable || showTopPager || showBothPager) && ( + + {isSearchable && ( + + )} + {(showTopPager || showBothPager) && ( + + )} + + )} {renderHeaders()} {renderBody(paginatedData[currentPage])} diff --git a/web/packages/design/src/DataTable/types.ts b/web/packages/design/src/DataTable/types.ts index 9f5ec0490653c..14f7c1344a99f 100644 --- a/web/packages/design/src/DataTable/types.ts +++ b/web/packages/design/src/DataTable/types.ts @@ -218,6 +218,7 @@ export type PagedTableProps = SearchableBasicTableProps & { prevPage: () => void; pagination: Pagination; fetching?: FetchingConfig; + isSearchable?: boolean; }; export type ServersideTableProps = BasicTableProps & {