31 lines
542 B
TypeScript
31 lines
542 B
TypeScript
import Link from 'next/link';
|
|
import React from 'react';
|
|
|
|
type BookingLinkProps = {
|
|
href: string;
|
|
children: React.ReactNode;
|
|
className?: string;
|
|
};
|
|
|
|
export default function BookingLink({
|
|
href,
|
|
children,
|
|
className,
|
|
}: BookingLinkProps) {
|
|
const isExternal = /^https?:\/\//.test(href);
|
|
|
|
if (isExternal) {
|
|
return (
|
|
<a href={href} className={className} target='_blank' rel='noreferrer'>
|
|
{children}
|
|
</a>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Link href={href} className={className}>
|
|
{children}
|
|
</Link>
|
|
);
|
|
}
|