Skip to content

Commit e34f013

Browse files
Fix invalid props being passed to <A> (#1420)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 1d6e1f2 commit e34f013

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ui/button-link.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1+
import { splitProps } from "solid-js";
12
import { A, type RouterLinkProps } from "./i18n-anchor";
23

34
type ButtonLinkProps = RouterLinkProps & {
45
variant: "primary" | "secondary";
56
};
67

78
export const ButtonLink = (props: ButtonLinkProps) => {
9+
const [localProps, otherProps] = splitProps(props, ["variant"]);
10+
811
return (
912
<A
1013
addLocale
1114
classList={{
1215
"rounded-full bg-blue-300 py-2 px-4 text-sm font-semibold text-slate-900 hover:bg-blue-200 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-300/50 active:bg-blue-500":
13-
props.variant === "primary",
16+
localProps.variant === "primary",
1417
"rounded-full bg-slate-800 py-2 px-4 text-sm font-semibold text-white hover:bg-slate-700 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/50 active:text-slate-300":
15-
props.variant === "secondary",
18+
localProps.variant === "secondary",
1619
}}
17-
{...props}
20+
{...otherProps}
1821
/>
1922
);
2023
};

0 commit comments

Comments
 (0)