Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/components/DataTable/DataTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export const Grouped: Story = {
header: 'Status'
}
],
enableResizing: false,
header: 'Internal'
},
{
Expand All @@ -241,15 +242,32 @@ export const Grouped: Story = {
header: 'Amount'
}
],
enableResizing: false,
header: 'Details'
}
],

data: createData(100),
onRowDoubleClick(row) {
alert(`row with ID ${row.id} double clicked`);
},
onSearchChange: () => {
return;
}
},
rowActions: [
{
label: 'Modify',
onSelect: () => {
alert('Modify');
}
},
{
destructive: true,
label: 'Delete',
onSelect: () => {
alert('Delete');
}
}
]
}
};
6 changes: 5 additions & 1 deletion src/components/DataTable/DataTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ export const DataTableBody: React.FC<
}
const content = flexRender(cell.column.columnDef.cell, cell.getContext());
return (
<div className="flex items-center border-r px-4 py-2 last:border-r-0" key={cell.id} style={style}>
<div
className="flex items-center border-r bg-inherit px-4 py-2 last:border-r-0"
key={cell.id}
style={style}
>
{content && typeof content === 'object' ? content : <span className="block truncate">{content}</span>}
</div>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/DataTable/DataTableHead.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ACTIONS_COLUMN_ID } from './constants.ts';
import { useDataTableHandle } from './hooks.ts';
import { flexRender } from './utils.tsx';

Expand All @@ -24,11 +25,12 @@ export const DataTableHead = () => {
style.position = 'sticky';
style.zIndex = 20;
}
// no border with actions on right
// TODO - consider resizing toggle in this case
if (header.column.getIsLastColumn('center')) {

const nextHeader = headerGroup.headers[header.index + 1];
if (nextHeader?.column.id === ACTIONS_COLUMN_ID) {
style.borderRight = 'none';
}

return (
<div
className="group/cell bg-background relative flex items-center border-r border-b px-4 py-2 last:border-r-0"
Expand Down
Loading