SupportLink.tsx28 lines · main
1import Link from 'next/link'
2import type { ComponentProps, PropsWithChildren } from 'react'
3
4import { createSupportFormUrl, type SupportFormUrlKeys } from './SupportForm.utils'
5import { takeBreadcrumbSnapshot } from '@/lib/breadcrumbs'
6
7export const SupportLink = ({
8 children,
9 queryParams,
10 ...props
11}: PropsWithChildren<
12 { queryParams?: Partial<SupportFormUrlKeys> } & Omit<ComponentProps<typeof Link>, 'href'>
13>) => {
14 const href = createSupportFormUrl(queryParams ?? {})
15
16 return (
17 <Link
18 {...props}
19 href={href}
20 onClick={(event) => {
21 takeBreadcrumbSnapshot()
22 props.onClick?.(event)
23 }}
24 >
25 {children}
26 </Link>
27 )
28}