feat(SW-392): Added book a table link click
This commit is contained in:
37
components/ButtonLink/index.tsx
Normal file
37
components/ButtonLink/index.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
"use client"
|
||||
|
||||
import NextLink from "next/link"
|
||||
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import { trackClick } from "@/utils/tracking"
|
||||
|
||||
import type { ButtonLinkProps } from "@/types/components/buttonLink"
|
||||
|
||||
export default function ButtonLink({
|
||||
children,
|
||||
href,
|
||||
target,
|
||||
trackingId,
|
||||
trackingParams,
|
||||
onClick,
|
||||
...buttonProps
|
||||
}: ButtonLinkProps) {
|
||||
return (
|
||||
<Button {...buttonProps} asChild>
|
||||
<NextLink
|
||||
href={href}
|
||||
target={target}
|
||||
onClick={(e) => {
|
||||
if (onClick) {
|
||||
onClick(e)
|
||||
}
|
||||
if (trackingId) {
|
||||
trackClick(trackingId, trackingParams)
|
||||
}
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</NextLink>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user