18 lines
538 B
TypeScript
18 lines
538 B
TypeScript
import { publicReference } from '@/lib/public-presentation';
|
|
export default function PublicReference({ value }: { value?: string | null }) {
|
|
const text = publicReference(value);
|
|
if (!text) return null;
|
|
if (/^https?:\/\//i.test(text))
|
|
return (
|
|
<a
|
|
className="underline"
|
|
href={text}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
Consultar fonte — {new URL(text).hostname}
|
|
</a>
|
|
);
|
|
return <>{text}</>;
|
|
}
|