Skip to content

Commit

Permalink
♿️ Add title to context icons
Browse files Browse the repository at this point in the history
  • Loading branch information
leeandher committed Jun 4, 2024
1 parent 21651cd commit 2b965d5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
18 changes: 16 additions & 2 deletions static/app/components/events/contexts/contextIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,16 @@ function getLogoImage(name: string) {
type Props = {
name: string;
hideUnknown?: boolean;
includeTitle?: boolean;
size?: IconSize;
};

function ContextIcon({name, size: providedSize = 'xl', hideUnknown = false}: Props) {
function ContextIcon({
name,
size: providedSize = 'xl',
hideUnknown = false,
includeTitle = false,
}: Props) {
const theme = useTheme();
const size = theme.iconSizes[providedSize];

Expand All @@ -155,7 +161,15 @@ function ContextIcon({name, size: providedSize = 'xl', hideUnknown = false}: Pro
return null;
}

return <img height={size} width={size} css={extraCass} src={imageName} />;
return (
<img
height={size}
width={size}
css={extraCass}
src={imageName}
title={includeTitle ? name : undefined}
/>
);
}

export default ContextIcon;
1 change: 1 addition & 0 deletions static/app/components/events/contexts/platform/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function getPlatformContextIcon({
format="sm"
platform={platformIconName}
data-test-id={`${platform}-context-icon`}
title={platformIconName}
/>
);
}
2 changes: 1 addition & 1 deletion static/app/components/events/contexts/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export function getContextIcon({
if (iconName.length === 0) {
return null;
}
return <ContextIcon name={iconName} size="sm" hideUnknown />;
return <ContextIcon name={iconName} size="sm" hideUnknown includeTitle />;
}

export function getFormattedContextData({
Expand Down

0 comments on commit 2b965d5

Please sign in to comment.