Skip to content

Commit 37b781e

Browse files
refactor(web): reuse inline settings actions
1 parent 53510d4 commit 37b781e

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎apps/web/src/components/settings/ExpandableText.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { InlineButton } from "../ui/button";
12
import { useId, useState } from "react";
23

34
import { cn } from "../../lib/utils";
@@ -33,15 +34,14 @@ export function ExpandableText({
3334
{text}
3435
</div>
3536
{canExpand ? (
36-
<button
37-
type="button"
37+
<InlineButton
3838
aria-expanded={expanded}
3939
aria-controls={textId}
40-
className="cursor-pointer mt-1 text-[11px] font-medium text-foreground/70 underline-offset-2 hover:text-foreground hover:underline"
40+
className="mt-1 text-[11px] font-medium text-foreground/70 underline-offset-2 hover:text-foreground hover:underline"
4141
onClick={() => setExpanded((value) => !value)}
4242
>
4343
{expanded ? "Show less" : expandLabel}
44-
</button>
44+
</InlineButton>
4545
) : null}
4646
</div>
4747
);

‎apps/web/src/components/settings/SettingInheritance.tsx‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { EnvironmentPresentation } from "../../state/environments";
1111
import { EnvironmentMachineIcon } from "../EnvironmentMachineIcon";
1212
import { resolveEnvModeLabel } from "../BranchToolbar.logic";
1313
import { PULL_REQUEST_MERGE_METHOD_LABELS } from "../pullRequest/pullRequestDetail.logic";
14-
import { Button } from "../ui/button";
14+
import { Button, InlineButton } from "../ui/button";
1515
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
1616
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
1717
import type { ProjectOverrideEntry, ScopedSettingsTarget } from "./scopedSettings";
@@ -261,13 +261,12 @@ export function SettingInheritance({
261261
<div className="flex items-center justify-between gap-3 px-2 text-xs text-muted-foreground">
262262
<span>Overridden by</span>
263263
{onClearOverrides ? (
264-
<button
265-
type="button"
266-
className="cursor-pointer font-medium text-foreground underline-offset-2 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
264+
<InlineButton
265+
className="font-medium text-foreground underline-offset-2 hover:underline"
267266
onClick={() => onClearOverrides(overriding)}
268267
>
269268
Reset {overriding.length === 1 ? "it" : "all"}
270-
</button>
269+
</InlineButton>
271270
) : null}
272271
</div>
273272
<ul role="list" className="mt-0.5 text-sm">
@@ -276,13 +275,12 @@ export function SettingInheritance({
276275
key={project.projectId}
277276
className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-2 py-1"
278277
>
279-
<button
280-
type="button"
281-
className="min-w-0 cursor-pointer truncate text-left text-foreground underline-offset-2 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
278+
<InlineButton
279+
className="min-w-0 justify-start text-left text-foreground underline-offset-2 hover:underline"
282280
onClick={project.open}
283281
>
284-
{project.label}
285-
</button>
282+
<span className="truncate">{project.label}</span>
283+
</InlineButton>
286284
<span className="max-w-32 truncate text-muted-foreground tabular-nums">
287285
{isProjectScopedSettingKey(key)
288286
? formatValue(key, overrides[project.projectId]?.[key])

0 commit comments

Comments
 (0)