Skip to content

Commit b5494f3

Browse files
committed
fix: ButtonLink onClick handler
1 parent c3afcfb commit b5494f3

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/components/Buttons/ButtonLink.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@ import { BaseLink, type LinkProps } from "@/components/Link"
44
import { type MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
55

66
export type ButtonLinkProps = LinkProps &
7-
Omit<ButtonProps, "toId" | "onClick"> & {
7+
Omit<ButtonProps, "toId"> & {
88
customEventOptions?: MatomoEventOptions
99
}
1010

11-
const ButtonLink = ({ customEventOptions, ...props }: ButtonLinkProps) => {
11+
const ButtonLink = ({
12+
customEventOptions,
13+
onClick,
14+
...props
15+
}: ButtonLinkProps) => {
1216
const handleClick = () => {
1317
customEventOptions && trackCustomEvent(customEventOptions)
1418
}
19+
1520
return (
16-
<Button as={BaseLink} activeStyle={{}} {...props} onClick={handleClick} />
21+
<Button
22+
as={BaseLink}
23+
activeStyle={{}}
24+
{...props}
25+
onClick={onClick ? onClick : handleClick}
26+
/>
1727
)
1828
}
1929

0 commit comments

Comments
 (0)