CONTENT-WP-0004 keeps outgoing and incoming labels apart, limits the graph to two hops, and stores focus and detail in the URL. Assistant: grok Assistant-Session: 01a1531b-6698-7732-8587-f28ea604bcdf
28 lines
885 B
TypeScript
28 lines
885 B
TypeScript
import type { EntityLink } from "@/lib/catalog";
|
|
|
|
/** A record link. Glossary and preview render only when that optional data is present. */
|
|
export function RecordLink({ link }: { link: EntityLink }) {
|
|
const anchor = link.href ? (
|
|
<a className="underline" href={link.href}>{link.title}</a>
|
|
) : (
|
|
<span>{link.title}</span>
|
|
);
|
|
return (
|
|
<span className="record-link">
|
|
{link.glossary ? (
|
|
<span className="glossary" data-glossary={link.glossary}>
|
|
{anchor}
|
|
<span className="glossary-tip" role="tooltip">{link.glossary}</span>
|
|
</span>
|
|
) : (
|
|
anchor
|
|
)}
|
|
{link.preview ? (
|
|
<span className="link-preview">
|
|
<span className="preview-title">{link.preview.title}</span>
|
|
<span className="preview-summary">{link.preview.summary}</span>
|
|
</span>
|
|
) : null}
|
|
</span>
|
|
);
|
|
}
|