Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
laratran committed Oct 28, 2024
1 parent bed15ab commit 9bf9468
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
table,
};

const divRef = useRef<any>(null);
const [isOverflowing, setIsOverflowing] = useState(false);
const cellHoverRevealDivRef = useRef<any>(null);
const [isCellContentOverflowing, setIsCellContentOverflowing] = useState(false);

useLayoutEffect(() => {
const div = divRef.current;
const div = cellHoverRevealDivRef.current;
if (div) {
const isOverflow = div.scrollWidth > div.clientWidth;
setIsOverflowing(isOverflow);
setIsCellContentOverflowing(isOverflow);
}
}, [tableCellProps.children]);

Expand Down Expand Up @@ -302,14 +302,15 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
})}
>
<>
{tableCellProps.children ??
(columnDef.enableCellHoverReveal ? (
<div ref={divRef}
className={
clsx(
{tableCellProps.children ?? (
columnDef.enableCellHoverReveal ? (
<div
ref={cellHoverRevealDivRef}
className={clsx(
columnDef.enableCellHoverReveal && classes["cell-hover-reveal"],
isOverflowing && classes['overflowing']
)}>
isCellContentOverflowing && classes['overflowing']
)}
>
{renderCellContent()}
{cell.getIsGrouped() && !columnDef.GroupedCell && (
<> ({row.subRows?.length})</>
Expand All @@ -322,7 +323,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
<> ({row.subRows?.length})</>
)}
</>
))}
)
)}
</>
</TableTd>
);
Expand Down

0 comments on commit 9bf9468

Please sign in to comment.