You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
769 B
43 lines
769 B
import type { ReactNode, MouseEvent } from 'react'
|
|
import React from 'react'
|
|
import { Link } from 'react-router-dom'
|
|
|
|
import { ProfileTypes, SportTypes } from 'config'
|
|
|
|
import { getProfileUrl } from './helpers'
|
|
|
|
type Props = {
|
|
children: ReactNode,
|
|
className?: string,
|
|
id: number,
|
|
onClick?: (e: MouseEvent<HTMLAnchorElement>) => void,
|
|
profileType: ProfileTypes,
|
|
sportType: SportTypes,
|
|
target?: string,
|
|
}
|
|
|
|
export const ProfileLink = ({
|
|
children,
|
|
className,
|
|
id,
|
|
onClick,
|
|
profileType,
|
|
sportType,
|
|
target,
|
|
}: Props) => {
|
|
const url = getProfileUrl({
|
|
id,
|
|
profileType,
|
|
sportType,
|
|
})
|
|
return (
|
|
<Link
|
|
to={url}
|
|
className={className}
|
|
target={target}
|
|
onClick={onClick}
|
|
>
|
|
{children}
|
|
</Link>
|
|
)
|
|
}
|
|
|