ConceptPortal-public/rsconcept/frontend/src/components/Common/TextURL.tsx

35 lines
602 B
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
import { Link } from 'react-router-dom';
interface TextURLProps {
text: string
tooltip?: string
href?: string
onClick?: () => void
2023-07-15 17:46:19 +03:00
}
function TextURL({ text, href, tooltip, onClick }: TextURLProps) {
if (href) {
return (
<Link
className='cursor-pointer hover:underline text-url'
title={tooltip}
to={href}
>
2023-07-15 17:46:19 +03:00
{text}
</Link>
);
} else if (onClick) {
return (
<span
className='cursor-pointer hover:underline text-url'
onClick={onClick}
>
{text}
</span>);
} else {
return null;
}
2023-07-15 17:46:19 +03:00
}
2023-07-25 20:27:29 +03:00
export default TextURL;