2023-07-15 17:46:19 +03:00
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
|
|
|
interface TextURLProps {
|
|
|
|
text: string
|
2023-12-05 01:22:44 +03:00
|
|
|
tooltip?: string
|
|
|
|
href?: string
|
2023-12-08 19:24:08 +03:00
|
|
|
color?: string
|
2023-12-05 01:22:44 +03:00
|
|
|
onClick?: () => void
|
2023-07-15 17:46:19 +03:00
|
|
|
}
|
|
|
|
|
2023-12-08 19:24:08 +03:00
|
|
|
function TextURL({ text, href, tooltip, color='text-url', onClick }: TextURLProps) {
|
|
|
|
const design = `cursor-pointer hover:underline ${color}`;
|
2023-12-05 01:22:44 +03:00
|
|
|
if (href) {
|
|
|
|
return (
|
|
|
|
<Link
|
2023-12-08 19:24:08 +03:00
|
|
|
className={design}
|
2023-12-05 01:22:44 +03:00
|
|
|
title={tooltip}
|
|
|
|
to={href}
|
2023-12-08 19:24:08 +03:00
|
|
|
tabIndex={-1}
|
2023-12-05 01:22:44 +03:00
|
|
|
>
|
2023-07-15 17:46:19 +03:00
|
|
|
{text}
|
|
|
|
</Link>
|
2023-12-05 01:22:44 +03:00
|
|
|
);
|
|
|
|
} else if (onClick) {
|
|
|
|
return (
|
|
|
|
<span
|
2023-12-08 19:24:08 +03:00
|
|
|
className={design}
|
2023-12-05 01:22:44 +03:00
|
|
|
onClick={onClick}
|
2023-12-08 19:24:08 +03:00
|
|
|
tabIndex={-1}
|
2023-12-05 01:22:44 +03:00
|
|
|
>
|
|
|
|
{text}
|
|
|
|
</span>);
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
2023-07-15 17:46:19 +03:00
|
|
|
}
|
|
|
|
|
2023-07-25 20:27:29 +03:00
|
|
|
export default TextURL;
|