Skip to content

Commit f77fddd

Browse files
authored
Merge pull request #596 from kmcfaul/th-props-fix
fix: allow user override of internal ThProps
2 parents 457aef4 + a52dc81 commit f77fddd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/module/src/DataViewTh/DataViewTh.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ export interface DataViewThResizableProps {
5858
id: string | number | undefined,
5959
width: number
6060
) => void;
61-
/** Width of the column */
61+
/** Starting width in pixels of the column */
6262
width?: number;
63-
/** Minimum width of the column */
63+
/** Minimum resize width in pixels of the column */
6464
minWidth?: number;
65-
/** Increment for keyboard navigation */
65+
/** Increment in pixels for keyboard navigation */
6666
increment?: number;
67-
/** Increment for keyboard navigation while shift is held */
67+
/** Increment in pixels for keyboard navigation while shift is held */
6868
shiftIncrement?: number;
6969
/** Provides an accessible name for the resizable column via a human readable string. */
7070
resizeButtonAriaLabel?: string;
@@ -324,14 +324,22 @@ export const DataViewTh: FC<DataViewThProps> = ({
324324
</Fragment>
325325
);
326326

327+
const classNames: string[] = [];
328+
if (thProps?.className) {
329+
classNames.push(thProps.className);
330+
}
331+
if (dataViewThClassName) {
332+
classNames.push(dataViewThClassName);
333+
}
334+
327335
return (
328336
<Th
337+
modifier="truncate"
329338
{...thProps}
330339
{...props}
331-
style={width > 0 ? { minWidth: width } : undefined}
332340
ref={thRef}
333-
modifier="truncate"
334-
className={dataViewThClassName}
341+
style={width > 0 ? { ...thProps?.style, minWidth: width } : thProps?.style}
342+
className={classNames.length > 0 ? classNames.join(' ') : undefined}
335343
{...(isResizable && { additionalContent: resizableContent })}
336344
>
337345
{content}

0 commit comments

Comments
 (0)