Skip to content

Commit 71c9b69

Browse files
refactor(web): Button consumers outside the composer stop restyling it (pingdotgg#13208)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
1 parent f465227 commit 71c9b69

38 files changed

Lines changed: 156 additions & 220 deletions

‎apps/web/src/browser/BrowserDeviceToolbar.tsx‎

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ export function BrowserDeviceToolbar({
242242
onChange={(event) => updateCustomDimension("width", event.target.value)}
243243
aria-label="Viewport width"
244244
aria-invalid={!customValid}
245-
className={cn(
246-
"text-center [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
247-
width >= 360 ? "w-14" : "w-13",
248-
)}
245+
className={width >= 360 ? "w-14" : "w-13"}
249246
/>
250247
<span className="text-xs text-muted-foreground">×</span>
251248
<Input
@@ -270,25 +267,21 @@ export function BrowserDeviceToolbar({
270267
onChange={(event) => updateCustomDimension("height", event.target.value)}
271268
aria-label="Viewport height"
272269
aria-invalid={!customValid}
273-
className={cn(
274-
"text-center [&_[data-slot=input]::-webkit-inner-spin-button]:appearance-none [&_[data-slot=input]]:[appearance:textfield]",
275-
width >= 360 ? "w-14" : "w-13",
276-
)}
270+
className={width >= 360 ? "w-14" : "w-13"}
277271
/>
278272
</form>
279273

280274
<Tooltip>
281275
<TooltipTrigger
282276
render={
283277
<Button
284-
variant="ghost"
278+
variant={aspectRatio === null ? "ghost" : "secondary"}
285279
size="icon-xs"
286280
type="button"
287281
aria-label={
288282
aspectRatio === null ? "Lock viewport aspect ratio" : "Unlock viewport aspect ratio"
289283
}
290284
aria-pressed={aspectRatio !== null}
291-
className={cn(aspectRatio !== null && "bg-accent text-foreground")}
292285
disabled={pending || !customValid}
293286
onPointerDown={(event) => event.preventDefault()}
294287
onClick={toggleAspectRatio}
@@ -315,19 +308,21 @@ export function BrowserDeviceToolbar({
315308
>
316309
<ScreenRotationIcon />
317310
</Button>
318-
<Button
319-
variant="ghost"
320-
size="icon-xs"
321-
type="button"
322-
aria-label="Close device toolbar"
323-
className="sticky right-0 ml-auto bg-background/95"
324-
disabled={pending}
325-
onClick={() => {
326-
apply({ _tag: "fill" }, null);
327-
}}
328-
>
329-
<X />
330-
</Button>
311+
{/* Sticky backing so scrolled controls do not show through the close action. */}
312+
<span className="sticky right-0 ml-auto flex bg-background/95">
313+
<Button
314+
variant="ghost"
315+
size="icon-xs"
316+
type="button"
317+
aria-label="Close device toolbar"
318+
disabled={pending}
319+
onClick={() => {
320+
apply({ _tag: "fill" }, null);
321+
}}
322+
>
323+
<X />
324+
</Button>
325+
</span>
331326
</div>
332327
);
333328
}

‎apps/web/src/components/ChatMarkdown.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,8 @@ function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) {
784784
render={
785785
<Button
786786
type="button"
787-
variant="ghost"
787+
variant={expanded ? "secondary" : "ghost-muted"}
788788
size="icon-xs"
789-
className="chat-markdown-chrome-action"
790789
aria-pressed={expanded}
791790
onClick={toggleExpanded}
792791
aria-label={expandLabel}
@@ -805,9 +804,8 @@ function MarkdownTable({ children, ...props }: React.ComponentProps<"table">) {
805804
render={
806805
<Button
807806
type="button"
808-
variant="ghost"
807+
variant="ghost-muted"
809808
size="icon-xs"
810-
className="chat-markdown-chrome-action"
811809
aria-label={copyLabel}
812810
/>
813811
}
@@ -993,9 +991,8 @@ function MarkdownCodeBlock({
993991
render={
994992
<Button
995993
type="button"
996-
variant="ghost"
994+
variant={wrapped ? "secondary" : "ghost-muted"}
997995
size="icon-xs"
998-
className="chat-markdown-chrome-action"
999996
aria-pressed={wrapped}
1000997
onClick={() => setWrapped((value) => !value)}
1001998
aria-label={wrapLabel}
@@ -1011,9 +1008,8 @@ function MarkdownCodeBlock({
10111008
render={
10121009
<Button
10131010
type="button"
1014-
variant="ghost"
1011+
variant="ghost-muted"
10151012
size="icon-xs"
1016-
className="chat-markdown-chrome-action"
10171013
onClick={handleCopy}
10181014
aria-label={copyLabel}
10191015
/>

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9991,7 +9991,7 @@ export default function ChatView(props: ChatViewProps) {
99919991
composerRef.current?.restoreAfterTimelineReachedEnd();
99929992
scrollToEnd(true);
99939993
}}
9994-
className="pointer-events-auto gap-1.5 rounded-full px-3 text-muted-foreground hover:text-foreground"
9994+
className="pointer-events-auto"
99959995
size="xs"
99969996
variant="glass"
99979997
>

‎apps/web/src/components/CommandPalette.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,9 +1528,8 @@ function OpenCommandPaletteDialog(props: {
15281528
<TooltipTrigger
15291529
render={
15301530
<Button
1531-
variant="outline"
1532-
size="xs"
1533-
className="h-5 rounded-[.25rem] px-1.5 text-[10px] text-warning-foreground"
1531+
variant="warning-outline"
1532+
size="micro"
15341533
onClick={() => {
15351534
openSourceControlSettings();
15361535
}}
@@ -2861,7 +2860,7 @@ function OpenCommandPaletteDialog(props: {
28612860
variant="outline"
28622861
size="xs"
28632862
tabIndex={-1}
2864-
className="absolute inset-e-2.5 top-1/2 gap-1.5 pe-1 ps-2 -translate-y-1/2"
2863+
className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"
28652864
aria-label={`${remoteProjectButtonLabel ?? "Continue"} (Enter)`}
28662865
disabled={!canSubmitRemoteProjectFlow}
28672866
onMouseDown={(event) => {
@@ -2888,10 +2887,7 @@ function OpenCommandPaletteDialog(props: {
28882887
variant="outline"
28892888
size="xs"
28902889
tabIndex={-1}
2891-
className={cn(
2892-
"absolute inset-e-2.5 top-1/2 pe-1 ps-2 -translate-y-1/2",
2893-
hasHighlightedBrowseItem ? "gap-1" : "gap-1.5",
2894-
)}
2890+
className="absolute inset-e-2.5 top-1/2 -translate-y-1/2"
28952891
aria-label={`${submitActionLabel} (${addShortcutLabel})`}
28962892
disabled={
28972893
!canCreateProjectInEnvironment(browseEnvironment?.connection.phase) ||

‎apps/web/src/components/CustomSnoozeDialog.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function CustomSnoozeDialog() {
119119
<Button
120120
id={`${id}-date`}
121121
variant="outline"
122-
className="w-full justify-between font-normal"
122+
className="w-full justify-between"
123123
/>
124124
}
125125
>

‎apps/web/src/components/DiffPanel.tsx‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,7 @@ export default function DiffPanel({
11251125
<Button
11261126
size="icon-micro"
11271127
variant="ghost"
1128-
className={cn(
1129-
"-ms-0.5 [--control-icon-color:currentColor] bg-transparent hover:bg-foreground/10",
1130-
getDiffCollapseIconClassName(fileDiff),
1131-
)}
1128+
className="-ms-0.5"
11321129
aria-label={
11331130
collapsed ? `Expand ${filePath}` : `Collapse ${filePath}`
11341131
}
@@ -1142,9 +1139,13 @@ export default function DiffPanel({
11421139
}
11431140
>
11441141
{collapsed ? (
1145-
<ChevronRightIcon className="size-4" />
1142+
<ChevronRightIcon
1143+
className={cn("size-4", getDiffCollapseIconClassName(fileDiff))}
1144+
/>
11461145
) : (
1147-
<ChevronDownIcon className="size-4" />
1146+
<ChevronDownIcon
1147+
className={cn("size-4", getDiffCollapseIconClassName(fileDiff))}
1148+
/>
11481149
)}
11491150
</TooltipTrigger>
11501151
<TooltipPopup side="top">

‎apps/web/src/components/GitActionsControl.tsx‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,8 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
646646
<TooltipTrigger
647647
render={
648648
<Button
649-
variant="outline"
650-
size="xs"
651-
className="h-5 rounded-[.25rem] px-1.5 text-[10px] text-warning-foreground"
649+
variant="warning-outline"
650+
size="micro"
652651
onClick={(event) => {
653652
event.preventDefault();
654653
event.stopPropagation();
@@ -1799,14 +1798,7 @@ export default function GitActionsControl({
17991798
<Popover>
18001799
<PopoverTrigger
18011800
openOnHover
1802-
render={
1803-
<Button
1804-
aria-disabled="true"
1805-
className="cursor-not-allowed rounded-e-none border-e-0 ps-[8.5px] opacity-64 before:rounded-e-none"
1806-
size="xs"
1807-
variant="outline"
1808-
/>
1809-
}
1801+
render={<Button aria-disabled="true" size="xs" variant="outline" />}
18101802
>
18111803
<GitQuickActionIcon
18121804
quickAction={quickAction}
@@ -1824,7 +1816,6 @@ export default function GitActionsControl({
18241816
<Button
18251817
variant="outline"
18261818
size="xs"
1827-
className="ps-[8.5px]"
18281819
disabled={isGitActionRunning || quickAction.disabled}
18291820
onClick={runQuickAction}
18301821
>
@@ -2056,16 +2047,16 @@ export default function GitActionsControl({
20562047
Abort
20572048
</Button>
20582049
<Button
2059-
className="min-h-8 w-full max-w-full whitespace-normal py-1.5 leading-snug sm:min-h-7 sm:w-auto"
2050+
className="w-full max-w-full sm:w-auto"
20602051
variant="outline"
2061-
size="sm"
2052+
size="sm-multiline"
20622053
onClick={continuePendingDefaultBranchAction}
20632054
>
20642055
{pendingDefaultBranchActionCopy?.continueLabel ?? "Continue"}
20652056
</Button>
20662057
<Button
2067-
className="min-h-8 w-full max-w-full whitespace-normal py-1.5 leading-snug sm:min-h-7 sm:w-auto"
2068-
size="sm"
2058+
className="w-full max-w-full sm:w-auto"
2059+
size="sm-multiline"
20692060
onClick={checkoutFeatureBranchAndContinuePendingAction}
20702061
>
20712062
Check out feature branch & continue

‎apps/web/src/components/ProjectScriptsControl.tsx‎

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,24 +192,28 @@ export default function ProjectScriptsControl({
192192
<MenuShortcut className="ms-0">{shortcutLabel}</MenuShortcut>
193193
</span>
194194
))}
195-
<Button
196-
type="button"
197-
variant="ghost"
198-
size="icon-xs"
199-
className={`absolute right-0 top-1/2 size-6 -translate-y-1/2 ${presentation === "menu" ? "" : "opacity-0 pointer-events-none transition-opacity group-hover:opacity-100 group-hover:pointer-events-auto group-focus-visible:opacity-100 group-focus-visible:pointer-events-auto"}`}
200-
aria-label={`Edit ${script.name}`}
201-
onPointerDown={(event) => {
202-
event.preventDefault();
203-
event.stopPropagation();
204-
}}
205-
onClick={(event) => {
206-
event.preventDefault();
207-
event.stopPropagation();
208-
openEditDialog(script);
209-
}}
195+
<span
196+
className={`absolute right-0 top-1/2 flex -translate-y-1/2 ${presentation === "menu" ? "" : "opacity-0 pointer-events-none transition-opacity group-hover:opacity-100 group-hover:pointer-events-auto group-focus-visible:opacity-100 group-focus-visible:pointer-events-auto"}`}
210197
>
211-
<SettingsIcon className="size-3.5" />
212-
</Button>
198+
<Button
199+
type="button"
200+
variant="ghost"
201+
size="icon-xs"
202+
className="size-6"
203+
aria-label={`Edit ${script.name}`}
204+
onPointerDown={(event) => {
205+
event.preventDefault();
206+
event.stopPropagation();
207+
}}
208+
onClick={(event) => {
209+
event.preventDefault();
210+
event.stopPropagation();
211+
openEditDialog(script);
212+
}}
213+
>
214+
<SettingsIcon className="size-3.5" />
215+
</Button>
216+
</span>
213217
</span>
214218
</MenuItem>
215219
);
@@ -269,7 +273,7 @@ export default function ProjectScriptsControl({
269273
<Button
270274
size="xs"
271275
variant="outline"
272-
className="w-7 px-0 sm:w-6 @3xl/header-actions:w-auto! @3xl/header-actions:px-[calc(--spacing(2)-1px)]"
276+
className="w-7 sm:w-6 @3xl/header-actions:w-auto!"
273277
aria-label={`Run ${primaryScript.name}`}
274278
// The tooltip wrapper replaces data-slot="button", so themed
275279
// toolbar styling needs its own hook.
@@ -329,7 +333,7 @@ export default function ProjectScriptsControl({
329333
<Button
330334
size="xs"
331335
variant="outline"
332-
className="w-7 px-0 sm:w-6 @3xl/header-actions:w-auto! @3xl/header-actions:px-[calc(--spacing(2)-1px)]"
336+
className="w-7 sm:w-6 @3xl/header-actions:w-auto!"
333337
aria-label="Add action"
334338
// The tooltip wrapper replaces data-slot="button", so themed
335339
// toolbar styling needs its own hook.

‎apps/web/src/components/ServerUpdateAction.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ export function ServerUpdateAction({
270270
render={
271271
<Button
272272
size="icon-xs"
273-
variant="ghost"
274-
className={className ?? "text-muted-foreground hover:text-foreground"}
273+
variant="ghost-muted"
274+
className={className}
275275
aria-label={`${actionLabel} for ${serverLabel}`}
276276
onClick={onClick}
277277
/>

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4500,7 +4500,7 @@ export default function Sidebar() {
45004500
tabIndex={-1}
45014501
aria-hidden="true"
45024502
title={`Project settings for ${project.displayName}`}
4503-
className="ml-auto focus-visible:bg-accent focus-visible:text-foreground"
4503+
className="ml-auto"
45044504
onPointerDown={(event) => event.stopPropagation()}
45054505
onClick={(event) => {
45064506
void handleProjectSettings(event, project);

0 commit comments

Comments
 (0)