Skip to content

Commit d47bcc4

Browse files
committed
⚡️ Minor aligns for demo
1 parent 0148e8a commit d47bcc4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

app/examples/column-resizing/ResizingExample.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export default function ResizingExample() {
1616
key,
1717
columns: [
1818
{ accessor: 'name', resizable },
19-
{ accessor: 'streetAddress', resizable },
20-
{ accessor: 'city', resizable },
19+
{ accessor: 'streetAddress', resizable, ellipsis: true },
20+
{ accessor: 'city', resizable, ellipsis: true },
2121
{ accessor: 'state', resizable },
22-
{ accessor: 'missionStatement', resizable },
22+
{ accessor: 'missionStatement', resizable, ellipsis: true },
2323
],
2424
});
2525

package/hooks/useColumnResize.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ export const useColumnResize = ({ onColumnResize, minColumnWidth = 50 }: UseColu
2424
event.stopPropagation();
2525

2626
const nextColumn = currentColumn.nextElementSibling as HTMLTableCellElement | null;
27-
if (!nextColumn) return false; // Can't resize without next column
27+
if (!nextColumn) {
28+
return false;
29+
}
2830

2931
const nextAccessor = nextColumn.getAttribute('data-accessor');
30-
if (!nextAccessor) return false; // Need accessor for next column
32+
if (!nextAccessor) {
33+
return false;
34+
}
3135

3236
const currentWidth = currentColumn.getBoundingClientRect().width;
3337
const nextWidth = nextColumn.getBoundingClientRect().width;
@@ -58,11 +62,6 @@ export const useColumnResize = ({ onColumnResize, minColumnWidth = 50 }: UseColu
5862

5963
const deltaX = clientX - resizeState.startX;
6064

61-
// Calculate new widths with constraints
62-
const newCurrentWidth = Math.max(minColumnWidth, resizeState.originalWidths.current + deltaX);
63-
64-
const newNextWidth = Math.max(minColumnWidth, resizeState.originalWidths.next - deltaX);
65-
6665
// Calculate the actual delta we can apply based on constraints
6766
const actualDelta = Math.min(
6867
deltaX,

0 commit comments

Comments
 (0)