Skip to content
TypeScript

fix(web): icons line up with the first line of their text (#18636)

Akash Moradiya26c6df72f82d
diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx
index 11fef9dbed3..516ab3caa0b 100644
--- a/apps/web/src/components/CommandPalette.tsx
+++ b/apps/web/src/components/CommandPalette.tsx
@@ -206,6 +206,7 @@ import { orderItemsByPreferredIds, sortLogicalProjectsForSidebar } from "./Sideb
import { resolveEnvironmentOptionLabel } from "./BranchToolbar.logic";
import { CommandPaletteContent } from "./CommandPaletteContent";
import {
+ CommandPaletteTitleIcon,
CommandPaletteVirtualizedResults,
scrollCommandPaletteRowIntoView,
} from "./CommandPaletteResults";
@@ -3274,7 +3275,9 @@ function OpenCommandPaletteDialog(props: {
{newProjectPathPreview !== null ? (
<div className="p-2 pb-0">
<div className="flex min-h-8 items-center gap-2 rounded-sm px-2 py-1.5">
- <FolderGit2Icon className={ITEM_ICON_CLASS} />
+ <CommandPaletteTitleIcon>
+ <FolderGit2Icon className={ITEM_ICON_CLASS} />
+ </CommandPaletteTitleIcon>
<span className="flex min-w-0 flex-1 flex-col">
<span className="truncate text-foreground text-sm">
{newProjectName.length > 0 ? newProjectName : "New project"}
@@ -3293,7 +3296,7 @@ function OpenCommandPaletteDialog(props: {
<div className="shrink-0 p-2 pb-0">
<div className="px-2 py-1.5 font-medium text-muted-foreground text-xs">Repository</div>
<div className="flex min-h-8 items-center gap-2 rounded-sm px-2 py-1.5">
- {remoteProjectContext.icon}
+ <CommandPaletteTitleIcon>{remoteProjectContext.icon}</CommandPaletteTitleIcon>
<span className="flex min-w-0 flex-1 flex-col">
<span className="truncate text-foreground text-sm">{remoteProjectContext.title}</span>
<span className="truncate text-muted-foreground/85 text-xs">
diff --git a/apps/web/src/components/CommandPaletteResults.tsx b/apps/web/src/components/CommandPaletteResults.tsx
index d0285035676..9e96b68d6ee 100644
--- a/apps/web/src/components/CommandPaletteResults.tsx
+++ b/apps/web/src/components/CommandPaletteResults.tsx
@@ -1,7 +1,7 @@
import { type ResolvedKeybindingsConfig } from "@t3tools/contracts";
import { LegendList, type LegendListRef } from "@legendapp/list/react";
import { ChevronRightIcon } from "lucide-react";
-import { type RefObject, useState } from "react";
+import { type ReactNode, type RefObject, useState } from "react";
import { cn } from "~/lib/utils";
import { shortcutLabelForCommand } from "../keybindings";
import {
@@ -150,12 +150,16 @@ export function CommandPaletteVirtualizedResults(props: CommandPaletteVirtualize
);
}
+export function CommandPaletteTitleIcon(props: { children: ReactNode }) {
+ return <span className="flex h-5 shrink-0 items-center self-start pt-0.5">{props.children}</span>;
+}
+
function DisabledCommandPaletteResultRow(props: {
item: CommandPaletteActionItem | CommandPaletteSubmenuItem;
}) {
return (
<div className="flex min-h-8 select-none items-center gap-2 rounded-sm px-2 py-1.5 text-base opacity-64 sm:min-h-7 sm:text-sm">
- {props.item.icon}
+ <CommandPaletteTitleIcon>{props.item.icon}</CommandPaletteTitleIcon>
{props.item.description || props.item.threadContentMatch ? (
<span className="flex min-w-0 flex-1 flex-col">
<span className="flex min-w-0 items-center gap-1.5 text-sm text-foreground">
@@ -205,7 +209,7 @@ function CommandPaletteResultRow(props: {
props.onExecuteItem(props.item);
}}
>
- {props.item.icon}
+ <CommandPaletteTitleIcon>{props.item.icon}</CommandPaletteTitleIcon>
{props.item.description || props.item.threadContentMatch ? (
<span className="flex min-w-0 flex-1 flex-col">
<span className="flex min-w-0 items-center gap-1.5 text-sm text-foreground">
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 9a54f3a99e7..e87861cf93f 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -1006,7 +1006,7 @@ function SidebarThreadTooltip({
{branchMismatch ? (
<div className="flex min-w-0 items-start gap-2 text-warning">
<CircleAlertIcon aria-hidden className="mt-0.5 size-3 shrink-0 stroke-current" />
- <div className="min-w-0 flex-1 wrap-break-word leading-5">
+ <div className="min-w-0 flex-1 wrap-break-word">
You're currently checked out on another branch.
</div>
</div>
diff --git a/apps/web/src/components/chat/ThreadDetailsPrRow.tsx b/apps/web/src/components/chat/ThreadDetailsPrRow.tsx
index 6b29ffa1f4e..5bf544f1416 100644
--- a/apps/web/src/components/chat/ThreadDetailsPrRow.tsx
+++ b/apps/web/src/components/chat/ThreadDetailsPrRow.tsx
@@ -279,7 +279,7 @@ export function ThreadDetailsPrRow({
{detail.isDraft && conflicting ? (
<div className="flex min-w-0 items-start gap-2 text-destructive">
<TriangleAlertIcon aria-hidden className="mt-0.5 size-3 shrink-0 stroke-current" />
- <div className="min-w-0 flex-1 wrap-break-word leading-5">
+ <div className="min-w-0 flex-1 wrap-break-word">
Merge conflicts with {detail.baseBranch}
</div>
</div>
diff --git a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
index 631d5ae26ee..1a84da3acb2 100644
--- a/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
+++ b/apps/web/src/components/diffs/DiffCommentAnnotation.tsx
@@ -63,7 +63,7 @@ export function DiffCommentAnnotation({
contentEditable={false}
onPointerDown={(event) => event.stopPropagation()}
>
- <MessageCircle className="mt-0.5 size-3.5 shrink-0 text-primary/70" aria-hidden="true" />
+ <MessageCircle className="size-3.5 h-5 shrink-0 text-primary/70" aria-hidden="true" />
<p className="min-w-0 flex-1 whitespace-pre-wrap text-sm leading-5">{displayedText}</p>
{onDelete ? (
<span className="-my-1 -mr-1 flex shrink-0 opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100 max-sm:opacity-100">
diff --git a/apps/web/src/components/pullRequest/guide/GuideStop.tsx b/apps/web/src/components/pullRequest/guide/GuideStop.tsx
index cc7557d3bb3..81e5aa407eb 100644
--- a/apps/web/src/components/pullRequest/guide/GuideStop.tsx
+++ b/apps/web/src/components/pullRequest/guide/GuideStop.tsx
@@ -249,7 +249,7 @@ export function GuideStop({
>
<MessageCircleQuestionIcon
aria-hidden
- className="mt-0.5 size-3.5 shrink-0 text-muted-foreground"
+ className="size-3.5 h-lh shrink-0 text-muted-foreground"
/>
<span className="sr-only">Ask an agent: </span>
<span>
diff --git a/apps/web/src/components/settings/DiagnosticsSettings.tsx b/apps/web/src/components/settings/DiagnosticsSettings.tsx
index f30ca4603ad..e2342ae58c4 100644
--- a/apps/web/src/components/settings/DiagnosticsSettings.tsx
+++ b/apps/web/src/components/settings/DiagnosticsSettings.tsx
@@ -979,13 +979,13 @@ export function DiagnosticsSettingsPanel() {
<div className="space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5">
{processDiagnosticsError ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{processDiagnosticsError.message}</span>
</div>
) : null}
{processError ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{processError}</span>
</div>
) : null}
@@ -1051,13 +1051,13 @@ export function DiagnosticsSettingsPanel() {
<div className="space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5">
{processResourceError ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{processResourceError.message}</span>
</div>
) : null}
{resourceError ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{resourceError}</span>
</div>
) : null}
@@ -1134,7 +1134,7 @@ export function DiagnosticsSettingsPanel() {
<div className="space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5">
{openLogsDirectoryError ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{openLogsDirectoryError}</span>
</div>
) : null}
@@ -1145,7 +1145,7 @@ export function DiagnosticsSettingsPanel() {
traceDiagnosticsPartialFailure ? "text-warning-foreground" : "text-destructive",
)}
>
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>
{traceDiagnosticsPartialFailure
? `Some trace files could not be read, so diagnostics may be incomplete. ${traceDiagnosticsError.message}`
@@ -1155,7 +1155,7 @@ export function DiagnosticsSettingsPanel() {
) : null}
{error ? (
<div className="flex items-start gap-2 text-destructive">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{error}</span>
</div>
) : null}
diff --git a/apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx b/apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx
index 0a02bb2ba90..3fd3b83f214 100644
--- a/apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx
+++ b/apps/web/src/components/settings/ResourceTelemetryDiagnostics.tsx
@@ -1055,7 +1055,7 @@ export function ResourceTelemetryDiagnostics({
</div>
{telemetry.error ? (
<div className="flex items-start gap-2 border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{telemetry.error}</span>
</div>
) : null}
@@ -1233,7 +1233,7 @@ export function ResourceTelemetryDiagnostics({
<div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-xs/5">
{history.error ? (
<div className="flex items-start gap-2 border-b border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
- <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
+ <AlertTriangleIcon className="size-3.5 h-lh shrink-0" />
<span>{history.error}</span>
</div>
) : null}
diff --git a/apps/web/src/components/settings/SettingsSidebarNav.tsx b/apps/web/src/components/settings/SettingsSidebarNav.tsx
index 661acb461df..9be69473783 100644
--- a/apps/web/src/components/settings/SettingsSidebarNav.tsx
+++ b/apps/web/src/components/settings/SettingsSidebarNav.tsx
@@ -104,7 +104,7 @@ const SETTINGS_NAV_ITEMS: ReadonlyArray<{
function SettingsSectionIcon({ to }: { to: SettingsPath }) {
const Icon = SETTINGS_SECTION_ICONS[to];
- return <Icon className="mt-0.5 size-3.5 shrink-0 text-sidebar-muted-foreground/60" />;
+ return <Icon className="size-3.5 h-5 shrink-0 text-sidebar-muted-foreground/60" />;
}
export function SettingsSidebarNav({ pathname }: { pathname: string }) {
diff --git a/apps/web/src/components/ui/toast.tsx b/apps/web/src/components/ui/toast.tsx
index 775832b9d67..73aab0ff657 100644
--- a/apps/web/src/components/ui/toast.tsx
+++ b/apps/web/src/components/ui/toast.tsx
@@ -239,7 +239,7 @@ function ToastDescriptionAndExpandable({
</div>
<MorphIcon
aria-hidden
- className="mt-0.5 size-3.5 shrink-0 text-muted-foreground opacity-80"
+ className="size-3.5 h-lh shrink-0 text-muted-foreground opacity-80"
icon={open ? ChevronUp : ChevronDown}
strokeWidth={2.25}
/>