1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-13 13:48:59 +02:00

refactor: tooltip title variable name

This commit is contained in:
Tymoteusz Czech 2025-07-29 20:26:31 +02:00
parent 3479aa8b2c
commit e684cc61c0
No known key found for this signature in database
GPG Key ID: 133555230D88D75F

View File

@ -52,7 +52,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
styles,
}) => {
const { setAnnouncement } = useContext(AnnouncerContext);
const [title, setTitle] = useState('');
const [tooltipTitle, setTooltipTitle] = useState('');
const ref = useRef<HTMLSpanElement>(null);
const ariaSort = isSorted
@ -93,17 +93,17 @@ export const CellSortable: FC<ICellSortableProps> = ({
}, [align]);
useEffect(() => {
const newTitle =
const newTooltipTitle =
ariaTitle &&
ref.current &&
ref?.current?.offsetWidth < ref?.current?.scrollWidth
? `${children}`
: '';
if (newTitle !== title) {
setTitle(newTitle);
if (newTooltipTitle !== tooltipTitle) {
setTooltipTitle(newTooltipTitle);
}
}, [setTitle, ariaTitle]);
}, [setTooltipTitle, ariaTitle]);
return (
<StyledTableCell
@ -117,7 +117,7 @@ export const CellSortable: FC<ICellSortableProps> = ({
<ConditionallyRender
condition={isSortable}
show={
<Tooltip title={title} arrow>
<Tooltip title={tooltipTitle} arrow>
<StyledButton
isSorted={isSorted}
type='button'