import { Viewer, DocumentGate } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { Stage, stagePlugin } from '@embedpdf/react/stage'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { SelectionLayer, selectionPlugin } from '@embedpdf/react/selection'; import { interactionPlugin } from '@embedpdf/react/interaction'; import { Anchored } from '@embedpdf/react/anchored'; import { AnnotationLayer, annotationPlugin, useAnnotationAnchor, useAnnotationState, } from '@embedpdf/react/annotation'; import { cloudEngine } from '@cloudpdf/engine'; import './hover-card.css'; const engine = cloudEngine(); const plugins = [ stagePlugin(), renderPlugin(), interactionPlugin(), selectionPlugin(), annotationPlugin(), ]; const proposal: OpenInput = { kind: 'grant', grant: 'shr_qnqHtCNRpzz-s7DPFBIbuOAF' }; // A card next to the annotation under the pointer: who wrote it, and what. function HoverCard() { const { hovered } = useAnnotationState(); // the annotation under the pointer, or null const anchor = useAnnotationAnchor(hovered?.ref ?? null); if (!hovered?.contents) return null; return (
{hovered.author ?? 'Someone'}

{hovered.contents}

); } export default function App() { return ( Loading…

}>

Point at a note or a marked sentence

}> {() => ( <> )}
); }