2025-07-13 10:37:43 +12:00
|
|
|
import { ArrowUpRight } from 'lucide-react';
|
2025-06-05 13:13:45 +12:00
|
|
|
import { PropsWithChildren } from 'react';
|
|
|
|
import clsx from 'clsx';
|
|
|
|
|
|
|
|
import { AutomationTestingProps } from '@/types';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
to: string;
|
|
|
|
className?: string;
|
2025-07-13 10:37:43 +12:00
|
|
|
showIcon?: boolean;
|
2025-06-05 13:13:45 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
export function ExternalLink({
|
|
|
|
to,
|
|
|
|
className,
|
|
|
|
children,
|
2025-07-13 10:37:43 +12:00
|
|
|
showIcon = true,
|
2025-06-05 13:13:45 +12:00
|
|
|
'data-cy': dataCy,
|
|
|
|
}: PropsWithChildren<Props & AutomationTestingProps>) {
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
href={to}
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
|
|
|
data-cy={dataCy}
|
2025-07-13 10:37:43 +12:00
|
|
|
className={clsx('inline-flex align-baseline', className)}
|
2025-06-05 13:13:45 +12:00
|
|
|
>
|
2025-07-13 10:37:43 +12:00
|
|
|
{children}
|
|
|
|
{showIcon && <ArrowUpRight className="align-top" />}
|
2025-06-05 13:13:45 +12:00
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|