Skip to content
Open
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
22 changes: 15 additions & 7 deletions packages/module/src/DataViewTh/DataViewTh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
id: string | number | undefined,
width: number
) => void;
/** Width of the column */
/** Starting width in pixels of the column */
width?: number;
/** Minimum width of the column */
/** Minimum resize width in pixels of the column */
minWidth?: number;
/** Increment for keyboard navigation */
/** Increment in pixels for keyboard navigation */
increment?: number;
/** Increment for keyboard navigation while shift is held */
/** Increment in pixels for keyboard navigation while shift is held */
shiftIncrement?: number;
/** Provides an accessible name for the resizable column via a human readable string. */
resizeButtonAriaLabel?: string;
Expand Down Expand Up @@ -139,7 +139,7 @@
observer.unobserve(observed);
}
};
}, []);

Check warning on line 142 in packages/module/src/DataViewTh/DataViewTh.tsx

View workflow job for this annotation

GitHub Actions / call-build-lint-test-workflow / lint

React Hook useEffect has a missing dependency: 'isResizable'. Either include it or remove the dependency array

useEffect(() => {
if ((isResizable || hasResizableColumns) && setInitialVals.current && width === 0) {
Expand Down Expand Up @@ -324,14 +324,22 @@
</Fragment>
);

const classNames: string[] = [];
if (thProps?.className) {
classNames.push(thProps.className);
}
if (dataViewThClassName) {
classNames.push(dataViewThClassName);
}

return (
<Th
modifier="truncate"
{...thProps}
{...props}
style={width > 0 ? { minWidth: width } : undefined}
ref={thRef}
modifier="truncate"
className={dataViewThClassName}
style={width > 0 ? { minWidth: width, ...thProps?.style } : thProps?.style}
className={classNames.length > 0 ? classNames.join(' ') : undefined}
{...(isResizable && { additionalContent: resizableContent })}
>
{content}
Expand Down
Loading