Skip to content

Commit

Permalink
chore: removing usage of loading indicator inside table
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanvn committed Nov 19, 2024
1 parent b878f2d commit e376108
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { TextDataCell } from './dataCells/TextDataCell';
import { DataTableDataCell, DataTableHeader } from './types';
import { WithKey } from '../../components/types';
import { CheckboxHeader } from './headers/CheckboxHeader';
import { STORAGE_BROWSER_BLOCK } from '../../constants';
import { ViewElement } from '../../context/elements';

export interface DataTableRow {
content: WithKey<DataTableDataCell>[];
Expand All @@ -21,14 +19,12 @@ export interface DataTableRow {
export interface DataTableProps {
headers: WithKey<DataTableHeader>[];
isLoading?: boolean;
loadingIndicator?: React.ReactNode;
rows: WithKey<DataTableRow>[];
}

export const DataTable = ({
headers,
isLoading,
loadingIndicator,
rows,
}: DataTableProps): React.JSX.Element => {
const mappedHeaders = headers.map(({ key, content, type }) => {
Expand Down Expand Up @@ -96,10 +92,5 @@ export const DataTable = ({
}),
}));

return (
<ViewElement className={`${STORAGE_BROWSER_BLOCK}__data-table`}>
<Table headers={mappedHeaders} rows={mappedRows} />
{isLoading ? loadingIndicator : null}
</ViewElement>
);
return <Table headers={mappedHeaders} rows={mappedRows} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const UNSORTABLE_GROUPS: DataTableDataCell['type'][] = ['checkbox'];

export const useDataTable = (): DataTableProps => {
const { data } = useControlsContext();
const { tableData } = data;
const { isLoading, loadingIndicator } = data;
const { isLoading, tableData } = data;

const defaultSortIndex = React.useMemo(
() => tableData?.headers?.findIndex(({ type }) => type === 'sort') ?? -1,
Expand Down Expand Up @@ -156,7 +155,6 @@ export const useDataTable = (): DataTableProps => {
return {
headers: mappedHeaders ?? [],
isLoading,
loadingIndicator,
rows: sortedRows ?? [],
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export interface ControlsContext {
isFolderNameDisabled?: boolean;
isOverwriteToggleDisabled?: boolean;
isSearchingSubfolders?: boolean;
loadingIndicator?: React.ReactNode;
loadingIndicatorLabel?: string;
location?: LocationState;
overwriteToggleLabel?: string;
Expand Down

0 comments on commit e376108

Please sign in to comment.