Skip to content

Commit

Permalink
renames (deephaven#1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Apr 11, 2024
1 parent 9acfc30 commit 4b2cd06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/components/src/spectrum/ItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export function ItemContent({
tooltipOptions,
}: ItemContentProps): JSX.Element | null {
const {
checkOverflowRef,
isOverflowing: isTextOverflowing,
ref: checkTextOverflowRef,
reset: resetIsOverflowing,
resetIsOverflowing,
} = useCheckOverflowRef();

const [previousContent, setPreviousContent] = useState(content);
Expand Down Expand Up @@ -66,7 +66,7 @@ export function ItemContent({
isElementOfType(el, Text)
? cloneElement(el, {
...el.props,
ref: checkTextOverflowRef,
ref: checkOverflowRef,
UNSAFE_className: cl(
el.props.UNSAFE_className,
stylesCommon.spectrumEllipsis
Expand All @@ -79,7 +79,7 @@ export function ItemContent({
if (typeof content === 'string' || typeof content === 'number') {
content = (
<Text
ref={checkTextOverflowRef}
ref={checkOverflowRef}
UNSAFE_className={stylesCommon.spectrumEllipsis}
>
{content}
Expand Down
14 changes: 8 additions & 6 deletions packages/react-hooks/src/useCheckOverflowRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { useCallback, useState } from 'react';
import type { DOMRefValue } from '@react-types/shared';

export interface CheckOverflowRefResult {
checkOverflowRef: <T extends HTMLElement>(
elRef: DOMRefValue<T> | null
) => void;
isOverflowing: boolean;
ref: <T extends HTMLElement>(elRef: DOMRefValue<T> | null) => void;
reset: () => void;
resetIsOverflowing: () => void;
}

export function useCheckOverflowRef(): CheckOverflowRefResult {
Expand All @@ -15,7 +17,7 @@ export function useCheckOverflowRef(): CheckOverflowRefResult {
* overflowing so we know whether to render a tooltip showing the full content
* or not.
*/
const ref = useCallback(
const checkOverflowRef = useCallback(
<T extends HTMLElement>(elRef: DOMRefValue<T> | null) => {
const el = elRef?.UNSAFE_getDOMNode();

Expand All @@ -30,14 +32,14 @@ export function useCheckOverflowRef(): CheckOverflowRefResult {
[]
);

const reset = useCallback(() => {
const resetIsOverflowing = useCallback(() => {
setIsOverflowing(false);
}, []);

return {
isOverflowing,
ref,
reset,
checkOverflowRef,
resetIsOverflowing,
};
}

Expand Down

0 comments on commit 4b2cd06

Please sign in to comment.