Skip to content

Commit

Permalink
fix(ui): all strings are clickable in object viewer (#3437)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning authored Jan 21, 2025
1 parent 2343a33 commit afe5c40
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const Spacer = styled.div`
`;
Spacer.displayName = 'S.Spacer';

const Collapsed = styled.div<{hasScrolling: boolean}>`
const Collapsed = styled.div`
min-height: 38px;
line-height: 38px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: ${props => (props.hasScrolling ? 'pointer' : 'default')};
cursor: pointer;
`;
Collapsed.displayName = 'S.Collapsed';

Expand Down Expand Up @@ -100,12 +100,10 @@ export const ValueViewString = ({value, isExpanded}: ValueViewStringProps) => {
setMode(hasScrolling ? (isExpanded ? 1 : 0) : 0);
}, [hasScrolling, isExpanded]);

const onClick = hasScrolling
? () => {
const numModes = hasFull ? 3 : 2;
setMode((mode + 1) % numModes);
}
: undefined;
const onClick = () => {
const numModes = hasFull ? 3 : 2;
setMode((mode + 1) % numModes);
};
const copy = useCallback(() => {
copyToClipboard(value);
toast('Copied to clipboard');
Expand Down Expand Up @@ -209,9 +207,5 @@ export const ValueViewString = ({value, isExpanded}: ValueViewStringProps) => {
</Column>
);
}
return (
<Collapsed hasScrolling={hasScrolling} onClick={onClick}>
{content}
</Collapsed>
);
return <Collapsed onClick={onClick}>{content}</Collapsed>;
};

0 comments on commit afe5c40

Please sign in to comment.