Skip to content

Commit dc702bd

Browse files
Zylphrexevanh
authored andcommitted
styles(explore): Make span description tooltip wider (#81084)
The default of 225px is too small for some longer span descriptions. Allow span descriptions tooltips to grow up to 400px.
1 parent da251c5 commit dc702bd

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

static/app/components/tooltip.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ export const TooltipContext = createContext<TooltipContextProps>({container: nul
2323

2424
interface TooltipProps extends UseHoverOverlayProps {
2525
/**
26-
* The content to show in the tooltip popover
26+
* The content to show in the tooltip popover.
2727
*/
2828
title: React.ReactNode;
2929
children?: React.ReactNode;
3030
/**
31-
* Disable the tooltip display entirely
31+
* Disable the tooltip display entirely.
3232
*/
3333
disabled?: boolean;
34+
/**
35+
* The max width the tooltip is allowed to grow.
36+
*/
37+
maxWidth?: number;
3438
/**
3539
* Additional style rules for the tooltip content.
3640
*/
@@ -42,6 +46,7 @@ function Tooltip({
4246
overlayStyle,
4347
title,
4448
disabled = false,
49+
maxWidth,
4550
...hoverOverlayProps
4651
}: TooltipProps) {
4752
const {container} = useContext(TooltipContext);
@@ -63,6 +68,7 @@ function Tooltip({
6368
const tooltipContent = isOpen && (
6469
<PositionWrapper zIndex={theme.zIndex.tooltip} {...overlayProps}>
6570
<TooltipContent
71+
maxWidth={maxWidth}
6672
animated
6773
arrowProps={arrowProps}
6874
originPoint={arrowData}
@@ -85,10 +91,10 @@ function Tooltip({
8591
);
8692
}
8793

88-
const TooltipContent = styled(Overlay)`
94+
const TooltipContent = styled(Overlay)<{maxWidth?: number}>`
8995
padding: ${space(1)} ${space(1.5)};
9096
overflow-wrap: break-word;
91-
max-width: 225px;
97+
max-width: ${p => p.maxWidth ?? 225}px;
9298
color: ${p => p.theme.textColor};
9399
font-size: ${p => p.theme.fontSizeSmall};
94100
line-height: 1.2;

static/app/utils/discover/fieldRenderers.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ type SpecialFields = {
364364
project: SpecialField;
365365
release: SpecialField;
366366
replayId: SpecialField;
367+
'span.description': SpecialField;
367368
'span.status_code': SpecialField;
368369
span_id: SpecialField;
369370
team_key_transaction: SpecialField;
@@ -492,6 +493,29 @@ const SPECIAL_FIELDS: SpecialFields = {
492493
return <Container>{getShortEventId(spanId)}</Container>;
493494
},
494495
},
496+
'span.description': {
497+
sortField: 'span.description',
498+
renderFunc: data => {
499+
const value = data['span.description'];
500+
501+
return (
502+
<Tooltip
503+
title={value}
504+
containerDisplayMode="block"
505+
showOnlyOnOverflow
506+
maxWidth={400}
507+
>
508+
<Container>
509+
{isUrl(value) ? (
510+
<ExternalLink href={value}>{value}</ExternalLink>
511+
) : (
512+
nullableValue(value)
513+
)}
514+
</Container>
515+
</Tooltip>
516+
);
517+
},
518+
},
495519
trace: {
496520
sortField: 'trace',
497521
renderFunc: data => {

0 commit comments

Comments
 (0)