Skip to content

Commit 22c9fd5

Browse files
ibetitsmikeethanndickson
authored andcommitted
🤖 fix: forwardRef GatewayIcon for Radix Tooltip (#1652)
Fixes the React warning (`Function components cannot be given refs`) when `GatewayIcon` is used as a Radix `TooltipTrigger` child (`asChild`). - Convert `GatewayIcon` to `React.forwardRef` and forward the ref to the underlying `<svg>`. Validation: - `make static-check` --- _Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `xhigh` • Cost: `$n/a`_
1 parent fa574ef commit 22c9fd5

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

src/browser/components/icons/GatewayIcon.tsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,31 @@ interface GatewayIconProps extends React.SVGProps<SVGSVGElement> {
1010
* Gateway icon - represents routing through Mux Gateway.
1111
* Circle with M logo. Active state adds outer ring.
1212
*/
13-
export function GatewayIcon(props: GatewayIconProps) {
14-
const { active, ...svgProps } = props;
13+
export const GatewayIcon = React.forwardRef<SVGSVGElement, GatewayIconProps>(
14+
function GatewayIcon(props, ref) {
15+
const { active, ...svgProps } = props;
1516

16-
return (
17-
<svg
18-
xmlns="http://www.w3.org/2000/svg"
19-
viewBox="0 0 24 24"
20-
fill="none"
21-
stroke="currentColor"
22-
strokeWidth="2"
23-
strokeLinecap="round"
24-
strokeLinejoin="round"
25-
{...svgProps}
26-
>
27-
{/* Outer glow ring when active */}
28-
{active && <circle cx="12" cy="12" r="11" strokeWidth="1" opacity="0.5" />}
29-
{/* Main circle */}
30-
<circle cx="12" cy="12" r="8" />
31-
{/* M letter */}
32-
<path d="M8 16V8l4 5 4-5v8" />
33-
</svg>
34-
);
35-
}
17+
return (
18+
<svg
19+
ref={ref}
20+
xmlns="http://www.w3.org/2000/svg"
21+
viewBox="0 0 24 24"
22+
fill="none"
23+
stroke="currentColor"
24+
strokeWidth="2"
25+
strokeLinecap="round"
26+
strokeLinejoin="round"
27+
{...svgProps}
28+
>
29+
{/* Outer glow ring when active */}
30+
{active && <circle cx="12" cy="12" r="11" strokeWidth="1" opacity="0.5" />}
31+
{/* Main circle */}
32+
<circle cx="12" cy="12" r="8" />
33+
{/* M letter */}
34+
<path d="M8 16V8l4 5 4-5v8" />
35+
</svg>
36+
);
37+
}
38+
);
39+
40+
GatewayIcon.displayName = "GatewayIcon";

0 commit comments

Comments
 (0)