Files
spacedrive/packages/interface/src/components/explorer/FileColumns.tsx
T
Jamie PineandBrendan Allan 677e1b63e9 [ENG-379] Explorer item resizer (#580)
* added item resizer
fixed explorer store bug
refactored file image component

* better sizing for videos

* fixed inspector width issue

* remove console.log

* added column titles to list view + extra details

* moved util

* remove imports

* Update packages/interface/src/components/explorer/FileColumns.tsx

Co-authored-by: Brendan Allan <brendonovich@outlook.com>

* address issues

* fix extension in file list name

* Update packages/interface/src/components/explorer/FileColumns.tsx

---------

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2023-02-25 06:16:57 +00:00

43 lines
1.2 KiB
TypeScript

export interface IColumn {
column: string;
key: string;
width: number;
}
export const LIST_VIEW_HEADER_HEIGHT = 40;
// Function ensure no types are lost, but guarantees that they are Column[]
export function ensureIsColumns<T extends IColumn[]>(data: T) {
return data;
}
export const columns = [
{ column: 'Name', key: 'name', width: 280 },
// { column: 'Size', key: 'size_in_bytes', width: 120 },
{ column: 'Type', key: 'extension', width: 150 },
{ column: 'Size', key: 'size', width: 100 },
{ column: 'Date Created', key: 'date_created', width: 150 },
{ column: 'Content ID', key: 'cas_id', width: 150 }
] as const satisfies Readonly<IColumn[]>;
export type ColumnKey = (typeof columns)[number]['key'];
export function ListViewHeader() {
return (
<div
style={{ height: LIST_VIEW_HEADER_HEIGHT }}
className="mr-2 flex w-full flex-row rounded-lg border-2 border-transparent"
>
{columns.map((col) => (
<div
key={col.column}
className="flex items-center px-4 py-2 pr-2"
style={{ width: col.width, marginTop: -LIST_VIEW_HEADER_HEIGHT * 2 }}
>
<span className="text-xs font-medium ">{col.column}</span>
</div>
))}
</div>
);
}