Skip to content

Commit f77638b

Browse files
committed
[chore] added example with ellipsis in table cells with hint
1 parent e48aa72 commit f77638b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

stories/components/base-components/ellipsis/docs/examples/multiple_use.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,21 @@ const Demo = () => {
1919

2020
const renderCell: DataTableProps<any, any, any>['renderCell'] | undefined = React.useMemo(() => {
2121
return (props) => {
22+
const cellRef = React.useRef<HTMLDivElement | null>(null);
23+
2224
if (props.columnName === 'vol') {
23-
return (
24-
<Text
25-
ellipsis={{ cropPosition: 'middle' }}
26-
hintProps={{ placement: 'right' }}
27-
flex={1}
28-
>
29-
{props.value}
30-
</Text>
31-
);
25+
return {
26+
ref: cellRef,
27+
children: (
28+
<Text
29+
ellipsis={{ cropPosition: 'middle' }}
30+
hintProps={{ placement: 'right', triggerRef: cellRef }}
31+
flex={1}
32+
>
33+
{props.value}
34+
</Text>
35+
),
36+
};
3237
}
3338

3439
return props.defaultRender();

0 commit comments

Comments
 (0)