Skip to content

Commit

Permalink
Updated DataTable rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Oct 8, 2023
1 parent 8b48130 commit ef9f8ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/app/(main)/settings/layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.menu {
width: 240px;
padding-top: 40px;
padding-top: 34px;
padding-right: 20px;
}

Expand Down
16 changes: 7 additions & 9 deletions src/components/common/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export interface DataTableProps {
error: unknown;
};
searchDelay?: number;
showSearch?: boolean;
showPaging?: boolean;
allowSearch?: boolean;
allowPaging?: boolean;
children: ReactNode | ((data: any) => ReactNode);
}

export function DataTable({
queryResult,
searchDelay = 600,
showSearch = true,
showPaging = true,
allowSearch = true,
allowPaging = true,
children,
}: DataTableProps) {
const { formatMessage, labels, messages } = useMessages();
Expand All @@ -58,7 +58,7 @@ export function DataTable({

return (
<>
{(hasData || query || isLoading) && showSearch && (
{allowSearch && (hasData || query) && (
<SearchField
className={styles.search}
value={query}
Expand All @@ -73,12 +73,10 @@ export function DataTable({
>
{hasData ? (typeof children === 'function' ? children(result) : children) : null}
{isLoading && <Loading icon="dots" />}
{!isLoading && !hasData && !query && (
<Empty message={formatMessage(messages.noDataAvailable)} />
)}
{!isLoading && !hasData && !query && <Empty />}
{noResults && <Empty message={formatMessage(messages.noResultsFound)} />}
</div>
{showPaging && (
{allowPaging && hasData && (
<Pager
className={styles.pager}
page={page}
Expand Down

0 comments on commit ef9f8ed

Please sign in to comment.