Skip to content

Commit

Permalink
chore(@clayui/core): adds support for resizer indicator in table
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemsteles committed Jun 28, 2024
1 parent c8c3588 commit c214d5c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/clay-core/src/table/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,32 @@ type Props = {
* Sets a text value if the component's content is not plain text.
*/
textValue?: string;

/**
* @ignore
*/
UNSAFE_resizable?: boolean;

/**
* @ignore
*/
UNSAFE_resizerClassName?: string;

/**
* @ignore
*/
UNSAFE_resizerOnMouseDown?: (
event: React.MouseEvent<HTMLDivElement, MouseEvent>
) => void;
} & React.ThHTMLAttributes<HTMLTableCellElement> &
React.TdHTMLAttributes<HTMLTableCellElement>;

export const Cell = React.forwardRef<HTMLTableCellElement, Props>(
function CellInner(
{
UNSAFE_resizable,
UNSAFE_resizerClassName,
UNSAFE_resizerOnMouseDown,
align,
children,
className,
Expand Down Expand Up @@ -325,6 +345,13 @@ export const Cell = React.forwardRef<HTMLTableCellElement, Props>(
) : (
children
)}

{UNSAFE_resizable && (
<div
className={UNSAFE_resizerClassName}
onMouseDown={UNSAFE_resizerOnMouseDown}
/>
)}
</As>
);
}
Expand Down

0 comments on commit c214d5c

Please sign in to comment.