Skip to content
TypeScript

fix(web): align pull request comment headers (#15341)

Josh McKinney89d4e8bef9f6
diff --git a/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx b/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
index 5e7b0027912..cd2633d416c 100644
--- a/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
@@ -87,7 +87,7 @@ function CommentIdentity({
? sourceControlClients.get(detail.provider).authorProfileUrl(actor.login, detail.url)
: null;
return (
- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-xs">
+ <div className="flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-1 text-xs">
<PullRequestActorLabel actor={actor} profileUrl={profileUrl} className="max-w-full" />
<Tooltip>
<TooltipTrigger
@@ -218,7 +218,7 @@ function CollapsedComment({
<Collapsible open={open} onOpenChange={setOpen}>
<article className="group rounded-lg border border-border/60 [contain-intrinsic-block-size:44px] [content-visibility:auto]">
<div className="p-3">
- <div className="flex flex-wrap items-start gap-2">
+ <div className="flex flex-wrap items-baseline gap-2">
<CommentIdentity comment={comment} detail={detail} />
<CollapsibleTrigger
ref={statusTriggerRef}
@@ -580,8 +580,8 @@ export function PullRequestSummaryTab({
// highlighted code, and the conversation is below the description either way.
className="group rounded-lg border border-border/60 bg-background [contain-intrinsic-block-size:160px] [content-visibility:auto]"
>
- <div className="flex flex-wrap items-start gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5">
- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-2 text-xs text-muted-foreground">
+ <div className="flex flex-wrap items-baseline gap-2 rounded-t-lg bg-muted/25 px-3 py-2.5">
+ <div className="flex min-w-0 flex-1 flex-wrap items-baseline gap-2 text-xs text-muted-foreground">
<CommentIdentity comment={comment} detail={detail} />
{outcome ? (
<PullRequestReviewOutcomeBadge outcome={outcome} />
@@ -593,12 +593,19 @@ export function PullRequestSummaryTab({
<Button
size="xs"
variant="ghost"
- className="-mt-1 shrink-0"
+ className="shrink-0"
disabled={pendingFinding !== null && pendingFinding !== undefined}
onClick={() => onFixFinding(finding)}
>
- <HammerIcon className="size-3" />
- {pendingFinding === pullRequestFindingKey(finding) ? "Preparing..." : fixFindingLabel}
+ {/* Export the text baseline rather than the hammer icon's bottom edge. */}
+ <span className="inline-flex items-baseline gap-1">
+ <HammerIcon className="size-3 self-center" />
+ <span>
+ {pendingFinding === pullRequestFindingKey(finding)
+ ? "Preparing..."
+ : fixFindingLabel}
+ </span>
+ </span>
</Button>
) : null}
{reactionBar}
diff --git a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
index 8a071493f51..b5e573f9677 100644
--- a/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
+++ b/apps/web/src/components/pullRequest/pullRequestPresentation.tsx
@@ -363,8 +363,11 @@ export function PullRequestReviewOutcomeBadge({
const presentation = REVIEW_OUTCOME_PRESENTATION[outcome];
return (
<Badge size="sm" variant={presentation.badgeVariant} className={className}>
- <presentation.Icon aria-hidden className="size-3" />
- {presentation.label}
+ {/* Align with surrounding text using the label, rather than the icon's bottom edge. */}
+ <span className="inline-flex items-baseline gap-1">
+ <presentation.Icon aria-hidden className="size-3 self-center" />
+ <span>{presentation.label}</span>
+ </span>
</Badge>
);
}
@@ -415,9 +418,10 @@ export function PullRequestActorLabel({
profileUrl?: string | null;
}) {
const login = actor?.login ?? "ghost";
+ // Let the name supply the group's baseline while the avatar stays vertically centered.
const label = (
- <span className={cn("flex min-w-0 items-center", variant === "label" && "gap-1.5")}>
- <PullRequestActorAvatar actor={actor} />
+ <span className={cn("flex min-w-0 items-baseline", variant === "label" && "gap-1.5")}>
+ <PullRequestActorAvatar actor={actor} className="self-center" />
<span className={variant === "label" ? "truncate font-medium text-foreground" : "sr-only"}>
{login}
</span>