Skip to content

Commit 82e3280

Browse files
committed
chore: update ButtonLink
1 parent b55dc25 commit 82e3280

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/Buttons/ButtonLink.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ 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"> & {
7+
Omit<ButtonProps, "toId" | "onClick"> & {
88
customEventOptions?: MatomoEventOptions
99
}
1010

11-
const ButtonLink = ({ ...props }: ButtonLinkProps) => {
12-
return <Button as={BaseLink} activeStyle={{}} {...props} />
11+
const ButtonLink = ({ customEventOptions, ...props }: ButtonLinkProps) => {
12+
const handleClick = () => {
13+
customEventOptions && trackCustomEvent(customEventOptions)
14+
}
15+
16+
return (
17+
<Button as={BaseLink} activeStyle={{}} {...props} onClick={handleClick} />
18+
)
1319
}
1420

1521
export default ButtonLink

0 commit comments

Comments
 (0)