Skip to content

Commit

Permalink
fix: Provide isSearchable prop to paginated table (#48174)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion authored Oct 31, 2024
1 parent 47494db commit 79aa545
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
36 changes: 21 additions & 15 deletions web/packages/design/src/DataTable/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export default function Table<T>(props: TableProps<T>) {
searchValue: state.searchValue,
setSearchValue,
fetching,
isSearchable,
};

if (state.pagination.CustomTable) {
Expand Down Expand Up @@ -279,6 +280,7 @@ function PagedTable<T>({
fetching,
className,
style,
isSearchable,
}: PagedTableProps<T>) {
const { pagerPosition, paginatedData, currentPage } = pagination;
const { showBothPager, showBottomPager, showTopPager } = getPagerPosition(
Expand All @@ -288,21 +290,25 @@ function PagedTable<T>({

return (
<>
<StyledPanel>
<InputSearch
searchValue={searchValue}
setSearchValue={setSearchValue}
/>
{(showTopPager || showBothPager) && (
<ClientSidePager
nextPage={nextPage}
prevPage={prevPage}
data={data}
{...fetching}
{...pagination}
/>
)}
</StyledPanel>
{(isSearchable || showTopPager || showBothPager) && (
<StyledPanel>
{isSearchable && (
<InputSearch
searchValue={searchValue}
setSearchValue={setSearchValue}
/>
)}
{(showTopPager || showBothPager) && (
<ClientSidePager
nextPage={nextPage}
prevPage={prevPage}
data={data}
{...fetching}
{...pagination}
/>
)}
</StyledPanel>
)}
<StyledTable className={className} style={style}>
{renderHeaders()}
{renderBody(paginatedData[currentPage])}
Expand Down
1 change: 1 addition & 0 deletions web/packages/design/src/DataTable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export type PagedTableProps<T> = SearchableBasicTableProps<T> & {
prevPage: () => void;
pagination: Pagination<T>;
fetching?: FetchingConfig;
isSearchable?: boolean;
};

export type ServersideTableProps<T> = BasicTableProps<T> & {
Expand Down

0 comments on commit 79aa545

Please sign in to comment.