-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic table for similar bed files and pdf download button for plots #155
Changes from 4 commits
8e15412
082c766
b43828a
86e9e37
52543cd
1f9eb9d
9e999c8
44f1592
0fc1b37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,17 +183,23 @@ export const Bed2BedSearchResultsTable = (props: Props) => { | |
getFilteredRowModel: getFilteredRowModel(), | ||
}); | ||
|
||
const handleRowClick = (id?: string) => (e: React.MouseEvent) => { | ||
if (!(e.target as HTMLElement).closest('button')) { | ||
window.location.href = `/bed/${id}`; | ||
} | ||
}; | ||
Comment on lines
+187
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious what this is doing? Are we able to somehow make it an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I get it. I was looking at it seems that there's not really a nice "right" way to make a row a link: https://stackoverflow.com/questions/17147821/how-to-make-a-whole-row-in-a-table-clickable-as-a-link I'm confused why its not just |
||
|
||
return ( | ||
<div className="rounded border shadow-sm p-1"> | ||
<div className="rounded border shadow-sm px-0 py-1"> | ||
<div className="d-flex flex-row mt-2"> | ||
<input | ||
className="form-control" | ||
className="form-control mx-3 mt-1 mb-2" | ||
placeholder="Search files" | ||
value={globalFilter} | ||
onChange={(e) => setGlobalFilter(e.target.value)} | ||
/> | ||
</div> | ||
<table className="table mb-2 text-sm"> | ||
<table className="table mb-2 text-sm table-hover"> | ||
<thead> | ||
{table.getHeaderGroups().map((headerGroup) => ( | ||
<tr key={headerGroup.id}> | ||
|
@@ -215,8 +221,8 @@ export const Bed2BedSearchResultsTable = (props: Props) => { | |
> | ||
{flexRender(header.column.columnDef.header, header.getContext())} | ||
{{ | ||
asc: ' 🔼', | ||
desc: ' 🔽', | ||
asc: <i className='bi bi-caret-up-fill ms-1' />, | ||
desc: <i className='bi bi-caret-down-fill ms-1' />, | ||
}[header.column.getIsSorted() as string] ?? null} | ||
</div> | ||
)} | ||
|
@@ -227,7 +233,11 @@ export const Bed2BedSearchResultsTable = (props: Props) => { | |
</thead> | ||
<tbody> | ||
{table.getRowModel().rows.map((row) => ( | ||
<tr key={row.id}> | ||
<tr | ||
key={row.id} | ||
onClick={handleRowClick(row.original.metadata?.id)} | ||
className="cursor-pointer" | ||
> | ||
{row.getVisibleCells().map((cell) => ( | ||
<td key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</td> | ||
))} | ||
|
@@ -236,8 +246,8 @@ export const Bed2BedSearchResultsTable = (props: Props) => { | |
</tbody> | ||
</table> | ||
<div className="h-4" /> | ||
<div className="d-flex justify-content-between align-items-center gap-2 mb-2"> | ||
<div className="d-flex flex-row align-items-center "> | ||
<div className="d-flex justify-content-between align-items-center gap-2 m-3"> | ||
<div className="d-flex flex-row align-items-center"> | ||
Showing | ||
<span className="fw-bold mx-1"> | ||
{table.getState().pagination.pageSize * table.getState().pagination.pageIndex + 1} to{' '} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
console.log
?