From 3a3a24cf5a1a52df44650b69d76225088cc9f2aa Mon Sep 17 00:00:00 2001 From: Chris Fang Date: Wed, 23 Oct 2024 14:31:59 -0700 Subject: [PATCH] chore(storage-browser): remove loading indicator and empty message from table --- .../composables/DataTable/DataTable.tsx | 15 +-------- .../__tests__/DataTable/DataTable.spec.tsx | 31 ------------------- .../StorageBrowser/controls/types.ts | 1 - 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/packages/react-storage/src/components/StorageBrowser/composables/DataTable/DataTable.tsx b/packages/react-storage/src/components/StorageBrowser/composables/DataTable/DataTable.tsx index 8dcab9aded7..2e1ad89ded1 100644 --- a/packages/react-storage/src/components/StorageBrowser/composables/DataTable/DataTable.tsx +++ b/packages/react-storage/src/components/StorageBrowser/composables/DataTable/DataTable.tsx @@ -1,7 +1,5 @@ import React from 'react'; -import { EmptyMessage } from '../../components/EmptyMessage'; -import { LoadingIndicator } from '../../components/LoadingIndicator'; import { Table } from '../../components/Table'; import { SortHeader } from './headers/SortHeader'; import { TextHeader } from './headers/TextHeader'; @@ -21,13 +19,11 @@ export interface DataTableRow { export interface DataTableProps { headers: WithKey[]; rows: WithKey[]; - isLoading?: boolean; } export const DataTable = ({ headers, rows, - isLoading, }: DataTableProps): React.JSX.Element => { const mappedHeaders = headers.map(({ key, content, type }) => { switch (type) { @@ -92,14 +88,5 @@ export const DataTable = ({ }), })); - return ( - <> - - {isLoading ? ( - - ) : mappedRows.length ? null : ( - No data available - )} - - ); + return
; }; diff --git a/packages/react-storage/src/components/StorageBrowser/composables/__tests__/DataTable/DataTable.spec.tsx b/packages/react-storage/src/components/StorageBrowser/composables/__tests__/DataTable/DataTable.spec.tsx index 0a95c0f5ef0..1f244cc94b1 100644 --- a/packages/react-storage/src/components/StorageBrowser/composables/__tests__/DataTable/DataTable.spec.tsx +++ b/packages/react-storage/src/components/StorageBrowser/composables/__tests__/DataTable/DataTable.spec.tsx @@ -101,35 +101,4 @@ describe('DataTable', () => { expect(row2DataCell2).toHaveTextContent('row-2-number'); expect(row2DataCell3).toHaveTextContent('row-2-text'); }); - - it('displays a loading indicator when loading', () => { - const { container } = render( - - ); - - const table = screen.queryByRole('table'); - const svg = container.querySelector('svg'); - - expect(table).toBeInTheDocument(); - expect(svg).toBeInTheDocument(); - }); - - it('displays a an empty message if there is no row data', () => { - const { container } = render( - - ); - - const table = screen.queryByRole('table'); - const tableHeaders = screen.getAllByRole('columnheader'); - const svg = container.querySelector('svg'); - const emptyMessage = screen.getByText('No data available'); - - expect(table).toBeInTheDocument(); - expect(tableHeaders).toHaveLength(1); - expect(emptyMessage).toBeInTheDocument(); - expect(svg).not.toBeInTheDocument(); - }); }); diff --git a/packages/react-storage/src/components/StorageBrowser/controls/types.ts b/packages/react-storage/src/components/StorageBrowser/controls/types.ts index 50be53b9189..bc7694a4f95 100644 --- a/packages/react-storage/src/components/StorageBrowser/controls/types.ts +++ b/packages/react-storage/src/components/StorageBrowser/controls/types.ts @@ -28,7 +28,6 @@ interface TableData { | TruncatedSortHeader )[]; rows: DataTableProps['rows']; - isLoading?: boolean; } export interface ControlsContext {