-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d306c4
commit c385ca4
Showing
2 changed files
with
60 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
import React from "react"; | ||
|
||
import ImageItem from "./ImageItem"; | ||
import ZarrUrl from "./ZarrUrl"; | ||
|
||
|
||
export default function CatelogTable({tableColumns, tableData, zarrColumns}) { | ||
|
||
function renderRow(rowdata) { | ||
return <React.Fragment> | ||
{tableColumns.map((col_name) => { | ||
if (col_name == "URL") { | ||
return <td key={col_name}><ZarrUrl source={rowdata[col_name]} /></td> | ||
} else { | ||
return <td key={col_name}>{rowdata[col_name]}</td> | ||
} | ||
})} | ||
</React.Fragment> | ||
} | ||
|
||
// ignore any row without a "URL" field | ||
const validRows = tableData.filter(rowdata => rowdata.URL?.length > 0); | ||
|
||
const table_rows = validRows.map((rowdata) => { | ||
// Each row is a combination of custom csv data and NGFF Image data | ||
return (<tr key={rowdata["URL"]}> | ||
{renderRow(rowdata)} | ||
<ImageItem | ||
source={rowdata["URL"]} | ||
zarr_columns={zarrColumns} | ||
/> | ||
</tr> | ||
); | ||
}); | ||
|
||
return ( | ||
<table> | ||
<tbody> | ||
<tr> | ||
{tableColumns.map((name) => ( | ||
<th key={name}>{name}</th> | ||
))} | ||
{zarrColumns.map((name) => ( | ||
<th key={name}>{name}</th> | ||
))} | ||
</tr> | ||
{table_rows} | ||
</tbody> | ||
</table> | ||
); | ||
} |