import { Viewer, DocumentGate, useDocument, useDocuments, useDocumentsState, } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { Stage, stagePlugin, useStage, useStageState } from '@embedpdf/react/stage'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { cloudEngine } from '@cloudpdf/engine'; import './tabs.css'; const engine = cloudEngine(); const plugins = [stagePlugin(), renderPlugin()]; const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' }; const article: OpenInput = { kind: 'grant', grant: 'shr_v09cJHOmj3C8vrfUlZNTDyqX' }; const sketch: OpenInput = { kind: 'grant', grant: 'shr_IyOgSdO4AmJqV4BoMv5V0nYU' }; function Tabs() { const documents = useDocuments(); const { documents: open, activeId } = useDocumentsState(); return (
{open.map((document) => (
))}
); } // The active tab: rename it, move it to the front, and zoom it. Each tab keeps its own zoom. function TabTools() { const documents = useDocuments(); const { id, name } = useDocument(); const stage = useStage(); const zoomLevel = useStageState((state) => state.zoomLevel); return (
documents.rename(id, event.target.value)} /> {Math.round(zoomLevel * 100)}%
); } export default function App() { return ( Opening…

}> {() => }
); }