Skip to content

Commit

Permalink
fix(storage-browser): move LOCATION_DETAIL_VIEW_HEADERS to constants …
Browse files Browse the repository at this point in the history
…file (#6022)
  • Loading branch information
calebpollman authored Nov 7, 2024
1 parent 98af62e commit 7f09467
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { LocationDetailViewHeaders } from './types';

export const LOCATION_DETAIL_VIEW_HEADERS: LocationDetailViewHeaders = [
{ key: 'checkbox', type: 'text', content: { text: '' } },
{ key: 'name', type: 'sort', content: { label: 'Name' } },
{ key: 'type', type: 'sort', content: { label: 'Type' } },
{ key: 'last-modified', type: 'sort', content: { label: 'Last Modified' } },
{ key: 'size', type: 'sort', content: { label: 'Size' } },
{ key: 'download', type: 'text', content: { text: '' } },
];
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { humanFileSize } from '@aws-amplify/ui';

import { DataTableProps } from '../../../composables/DataTable';
import { LocationData } from '../../../actions';
import { LOCATION_DETAIL_VIEW_HEADERS } from './getLocationDetailViewTableData';
import { humanFileSize } from '@aws-amplify/ui';
import { displayText } from '../../../displayText/en';

import { LOCATION_DETAIL_VIEW_HEADERS } from './constants';

export const getFileRowContent = ({
currentLocation,
currentPath,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataTableProps } from '../../../composables/DataTable';
import { LOCATION_DETAIL_VIEW_HEADERS } from './getLocationDetailViewTableData';
import { LOCATION_DETAIL_VIEW_HEADERS } from './constants';

export const getFolderRowContent = ({
itemSubPath,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
import { WithKey } from '../../../components/types';
import { DataTableProps } from '../../../composables/DataTable';
import { LocationData } from '../../../actions';
import { LocationItemData } from '../../../../../../dist/types/components/StorageBrowser/actions';
import { LocationItemData } from '../../../actions/handlers';
import { getFileRowContent } from './getFileRowContent';
import { getFolderRowContent } from './getFolderRowContent';
import { displayText } from '../../../displayText/en';
import { FileData } from '../../../actions/handlers';

type HeaderKeys =
| 'checkbox'
| 'name'
| 'type'
| 'last-modified'
| 'size'
| 'download';

export const LOCATION_DETAIL_VIEW_HEADERS: WithKey<
DataTableProps['headers'][number],
HeaderKeys
>[] = [
{ key: 'checkbox', type: 'text', content: { text: '' } },
{ key: 'name', type: 'sort', content: { label: 'Name' } },
{ key: 'type', type: 'sort', content: { label: 'Type' } },
{ key: 'last-modified', type: 'sort', content: { label: 'Last Modified' } },
{ key: 'size', type: 'sort', content: { label: 'Size' } },
{ key: 'download', type: 'text', content: { text: '' } },
];
import { LOCATION_DETAIL_VIEW_HEADERS } from './constants';

export const getLocationDetailViewTableData = ({
areAllFilesSelected,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { DataTableProps } from '../../../composables/DataTable';
import { WithKey } from '../../../components/types';

export type HeaderKeys =
| 'checkbox'
| 'name'
| 'type'
| 'last-modified'
| 'size'
| 'download';

export type LocationDetailViewHeaders = WithKey<
DataTableProps['headers'][number],
HeaderKeys
>[];

0 comments on commit 7f09467

Please sign in to comment.