2022-08-25 01:44:14 +00:00
|
|
|
import Link from "next/link";
|
|
|
|
|
|
|
|
interface ILinkTextProps {
|
|
|
|
href: string;
|
|
|
|
children: React.ReactNode;
|
|
|
|
classNameChildren?: string;
|
2022-10-21 17:50:15 +00:00
|
|
|
target?: string;
|
2022-08-25 01:44:14 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* This component had to be made in order to make i18n work with next/link
|
|
|
|
* @see https://github.com/i18next/react-i18next/issues/1090#issuecomment-615426145
|
|
|
|
**/
|
|
|
|
export const LinkText = (props: ILinkTextProps) => {
|
2022-10-21 17:50:15 +00:00
|
|
|
const { target, href, children, classNameChildren, ...moreProps } = props;
|
2022-08-25 01:44:14 +00:00
|
|
|
return (
|
|
|
|
<Link href={href || ""} {...moreProps}>
|
2022-10-21 17:50:15 +00:00
|
|
|
<a target={target || ""} className={classNameChildren}>
|
|
|
|
{children}
|
|
|
|
</a>
|
2022-08-25 01:44:14 +00:00
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
};
|