Skip to content
TypeScript

refactor(web): ghost-muted icons follow the text; add ghost-destructive (#13033)

Julius Marminge18aa7036732c
diff --git a/apps/web/src/components/LegacySidebar.tsx b/apps/web/src/components/LegacySidebar.tsx
index 5e60b9b0df7..f891e73694e 100644
--- a/apps/web/src/components/LegacySidebar.tsx
+++ b/apps/web/src/components/LegacySidebar.tsx
@@ -3038,7 +3038,6 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
variant="ghost-muted"
aria-label="Add project"
data-testid="sidebar-add-project-trigger"
- className="[--control-icon-color:currentColor] text-icon-muted"
onClick={openAddProject}
/>
}
diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx
index e66909c0f9f..de2a0d61ee4 100644
--- a/apps/web/src/components/RightPanelTabs.tsx
+++ b/apps/web/src/components/RightPanelTabs.tsx
@@ -559,7 +559,7 @@ function RightPanelEmptyState(props: {
render={
<Button
aria-label="Open browser in a profile"
- className="absolute top-1/2 right-8 -translate-y-1/2 [--control-icon-color:currentColor]"
+ className="absolute top-1/2 right-8 -translate-y-1/2"
size="icon-xs"
variant="ghost-muted"
/>
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 799ab3f9e54..a4dc6820d51 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -4517,7 +4517,7 @@ export default function Sidebar() {
tabIndex={-1}
aria-hidden="true"
title={`Project settings for ${project.displayName}`}
- className="ml-auto [--control-icon-color:currentColor] text-icon-muted focus-visible:bg-accent focus-visible:text-foreground"
+ className="ml-auto focus-visible:bg-accent focus-visible:text-foreground"
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
void handleProjectSettings(event, project);
diff --git a/apps/web/src/components/chat/SnapShotAttachmentDetails.tsx b/apps/web/src/components/chat/SnapShotAttachmentDetails.tsx
index e37b3f0824b..f781f1fbfa0 100644
--- a/apps/web/src/components/chat/SnapShotAttachmentDetails.tsx
+++ b/apps/web/src/components/chat/SnapShotAttachmentDetails.tsx
@@ -150,7 +150,7 @@ export function SnapShotContentsButton({
aria-label={
includesAccessibility ? "View accessibility data" : "No accessibility data"
}
- className={cn("[--control-icon-color:currentColor]", className)}
+ className={className}
onClick={(event) => event.stopPropagation()}
size="icon-micro"
variant="ghost-muted"
diff --git a/apps/web/src/components/pullRequest/PullRequestListFilters.tsx b/apps/web/src/components/pullRequest/PullRequestListFilters.tsx
index f769dd70fa4..c627ff99828 100644
--- a/apps/web/src/components/pullRequest/PullRequestListFilters.tsx
+++ b/apps/web/src/components/pullRequest/PullRequestListFilters.tsx
@@ -500,14 +500,7 @@ export function PullRequestFiltersMenu({
];
return (
<Menu onOpenChange={onOpenChange}>
- <MenuTrigger
- render={
- <Button
- className={filterCount > 0 ? "[--control-icon-color:currentColor]" : undefined}
- variant="outline"
- />
- }
- >
+ <MenuTrigger render={<Button variant="outline" />}>
<ListFilterIcon className="size-4" />
<span>Filters</span>
{filterCount > 0 ? (
diff --git a/apps/web/src/components/settings/ProviderInstanceCard.tsx b/apps/web/src/components/settings/ProviderInstanceCard.tsx
index eebd871735d..cfad142fbef 100644
--- a/apps/web/src/components/settings/ProviderInstanceCard.tsx
+++ b/apps/web/src/components/settings/ProviderInstanceCard.tsx
@@ -300,10 +300,6 @@ function ProviderEnvironmentSection(props: {
type="button"
size="icon-micro"
variant="ghost-muted"
- className={cn(
- "[--control-icon-color:currentColor]",
- variable.sensitive && "text-foreground",
- )}
onClick={() => {
const sensitive = !variable.sensitive;
updateVariable(variable.id, {
@@ -331,8 +327,7 @@ function ProviderEnvironmentSection(props: {
<Button
type="button"
size="icon-micro"
- variant="ghost-muted"
- className="[--control-icon-color:currentColor] hover:text-destructive"
+ variant="ghost-destructive"
onClick={() => removeVariable(variable.id)}
aria-label={`Remove environment variable ${variable.name || index + 1}`}
>
@@ -704,16 +699,12 @@ export function ProviderInstanceCard({
<Button
type="button"
size="icon-xs"
- variant="ghost"
- className={cn(
- "[--control-icon-color:currentColor]",
- versionAdvisory.emphasis === "strong"
- ? "text-warning hover:text-warning"
- : "text-muted-foreground hover:text-foreground",
- )}
+ variant="ghost-muted"
aria-label="Update available — view details"
>
- <ArrowUpCircleIcon />
+ <ArrowUpCircleIcon
+ className={cn(versionAdvisory.emphasis === "strong" && "text-warning")}
+ />
</Button>
}
/>
@@ -793,9 +784,8 @@ export function ProviderInstanceCard({
<Button
type="button"
size="icon-xs"
- variant="ghost-muted"
+ variant="ghost-destructive"
disabled={readOnly}
- className="[--control-icon-color:currentColor] hover:text-destructive"
onClick={onDelete}
aria-label={`Delete instance ${instanceId}`}
>
diff --git a/apps/web/src/components/settings/ProviderModelsSection.tsx b/apps/web/src/components/settings/ProviderModelsSection.tsx
index 0cc88eb0638..115baa26d05 100644
--- a/apps/web/src/components/settings/ProviderModelsSection.tsx
+++ b/apps/web/src/components/settings/ProviderModelsSection.tsx
@@ -312,13 +312,7 @@ export function ProviderModelsSection({
render={
<Button
size="icon-micro"
- variant="ghost"
- className={cn(
- "[--control-icon-color:currentColor]",
- isFavorite
- ? "text-yellow-500 hover:text-yellow-600"
- : "text-muted-foreground/40 hover:text-muted-foreground",
- )}
+ variant="ghost-muted"
onClick={() => handleToggleFavorite(model.slug)}
aria-label={`${isFavorite ? "Remove" : "Add"} ${model.name} ${
isFavorite ? "from" : "to"
@@ -326,7 +320,7 @@ export function ProviderModelsSection({
/>
}
>
- <StarIcon className={cn("size-3", isFavorite && "fill-current")} />
+ <StarIcon className={cn("size-3", isFavorite && "fill-current text-warning")} />
</TooltipTrigger>
<TooltipPopup side="top">
{isFavorite ? "Remove from favorites" : "Add to favorites"}
diff --git a/apps/web/src/components/settings/SettingInheritance.tsx b/apps/web/src/components/settings/SettingInheritance.tsx
index a351fa5fa25..fe596a9c152 100644
--- a/apps/web/src/components/settings/SettingInheritance.tsx
+++ b/apps/web/src/components/settings/SettingInheritance.tsx
@@ -208,22 +208,18 @@ export function SettingInheritance({
size="icon-micro"
variant="ghost-muted"
aria-label={`${overrideSummary}. Show where this value comes from`}
- className={cn(
- "[--control-icon-color:currentColor]",
- state === "overridden"
- ? "text-primary hover:text-primary"
- : state === "mixed"
- ? "text-warning hover:text-warning"
- : state === "environment"
- ? "text-foreground/70 hover:text-foreground"
- : "text-muted-foreground/60 hover:text-foreground",
- )}
/>
}
/>
}
>
- <LayersIcon className="size-3" />
+ <LayersIcon
+ className={cn(
+ "size-3",
+ state === "overridden" && "text-primary",
+ state === "mixed" && "text-warning",
+ )}
+ />
</TooltipTrigger>
<TooltipPopup side="top">{overrideSummary}</TooltipPopup>
</Tooltip>
diff --git a/apps/web/src/components/settings/ThemeSettings.tsx b/apps/web/src/components/settings/ThemeSettings.tsx
index 6403555c484..bf3305ba5a1 100644
--- a/apps/web/src/components/settings/ThemeSettings.tsx
+++ b/apps/web/src/components/settings/ThemeSettings.tsx
@@ -387,8 +387,7 @@ function ThemeLibraryCard({
: `Remove ${theme.label}`
}
size="icon-xs"
- variant="ghost"
- className="text-muted-foreground hover:text-destructive"
+ variant="ghost-destructive"
onClick={(event) => {
event.stopPropagation();
onRemove();
diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsx
index 898e205d484..f3dc3efbd42 100644
--- a/apps/web/src/components/ui/button.tsx
+++ b/apps/web/src/components/ui/button.tsx
@@ -49,7 +49,9 @@ const buttonVariants = cva(
ghost:
"[--control-icon-color:var(--contrast-muted-foreground)] border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent",
"ghost-muted":
- "[--control-icon-color:var(--contrast-muted-foreground)] border-transparent text-muted-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-foreground",
+ "[--control-icon-color:currentColor] border-transparent text-muted-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-foreground",
+ "ghost-destructive":
+ "[--control-icon-color:currentColor] border-transparent text-muted-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-destructive",
glass:
"surface-glass [--control-icon-color:var(--contrast-muted-foreground)] border-border/60 text-foreground shadow-sm [:hover,[data-pressed]]:border-border",
link: "border-transparent underline-offset-4 [:hover,[data-pressed]]:underline",
diff --git a/scripts/lint-restyle-ceiling.ts b/scripts/lint-restyle-ceiling.ts
index 8940a53e589..5fe692ce866 100644
--- a/scripts/lint-restyle-ceiling.ts
+++ b/scripts/lint-restyle-ceiling.ts
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
-export const RESTYLE_CEILING = 899;
+export const RESTYLE_CEILING = 865;
const RULE = "shadcn(no-restyle)";