Skip to content

Commit fa90750

Browse files
refactor(web): share the PR filter radio indicator
1 parent fd9691b commit fa90750

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎apps/web/src/components/pullRequest/PullRequestListFilters.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
SourceControlProviderKind,
99
} from "@t3tools/contracts";
1010
import {
11-
CheckIcon,
1211
CircleCheckIcon,
1312
CircleDashedIcon,
1413
CircleSlashIcon,
@@ -38,6 +37,7 @@ import {
3837
MenuPopup,
3938
MenuRadioGroup,
4039
MenuRadioItem,
40+
MenuRadioItemIndicator,
4141
MenuSeparator,
4242
MenuSub,
4343
MenuSubPopup,
@@ -206,7 +206,7 @@ function PullRequestFilterRadioGroup<Value extends string>({
206206
<PullRequestFilterOptionIcon option={option} />
207207
<span className="min-w-0 flex-1 truncate">{option.label}</span>
208208
{option.unavailable ? <span className="shrink-0">· Unavailable</span> : null}
209-
{option.value === value ? <CheckIcon aria-hidden className="size-3.5" /> : null}
209+
<MenuRadioItemIndicator />
210210
</span>
211211
</MenuRadioItem>
212212
);

‎apps/web/src/components/ui/menu.tsx‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
4-
import { ChevronRightIcon } from "lucide-react";
4+
import { CheckIcon, ChevronRightIcon } from "lucide-react";
55
import type * as React from "react";
66

77
import { cn } from "~/lib/utils";
@@ -177,6 +177,23 @@ function MenuRadioItem({
177177
);
178178
}
179179

180+
function MenuRadioItemIndicator({
181+
className,
182+
children,
183+
...props
184+
}: MenuPrimitive.RadioItemIndicator.Props) {
185+
return (
186+
<MenuPrimitive.RadioItemIndicator
187+
aria-hidden
188+
className={cn("flex shrink-0", className)}
189+
data-slot="menu-radio-item-indicator"
190+
{...props}
191+
>
192+
{children ?? <CheckIcon className="size-3.5" />}
193+
</MenuPrimitive.RadioItemIndicator>
194+
);
195+
}
196+
180197
function MenuGroupLabel({
181198
className,
182199
inset,
@@ -300,6 +317,7 @@ export {
300317
MenuRadioGroup as DropdownMenuRadioGroup,
301318
MenuRadioItem,
302319
MenuRadioItem as DropdownMenuRadioItem,
320+
MenuRadioItemIndicator,
303321
MenuGroupLabel,
304322
MenuGroupLabel as DropdownMenuLabel,
305323
MenuSeparator,

0 commit comments

Comments
 (0)