diff --git a/blocks/file-blocks/annotate-react/CodeSandbox.tsx b/blocks/file-blocks/annotate-react/CodeSandbox.tsx index 3176382..38073ff 100644 --- a/blocks/file-blocks/annotate-react/CodeSandbox.tsx +++ b/blocks/file-blocks/annotate-react/CodeSandbox.tsx @@ -11,7 +11,8 @@ export const CodeSandbox = ({ }) => { const files = useMemo( () => ({ - "/App.js": children, + "/src/index.js": { code: children }, + "/src/styles.css": { code: "" }, }), [children] ); @@ -28,8 +29,8 @@ export const CodeSandbox = ({ height: "100%", }} > - {/* - */} + ); }; diff --git a/blocks/file-blocks/annotate-react/index.tsx b/blocks/file-blocks/annotate-react/index.tsx index d2446f0..60a866e 100644 --- a/blocks/file-blocks/annotate-react/index.tsx +++ b/blocks/file-blocks/annotate-react/index.tsx @@ -21,7 +21,7 @@ import { TextInput, ActionList, } from "@primer/react"; -import { CheckIcon, PlusIcon, TrashIcon } from "@primer/octicons-react"; +import { PlusIcon, TrashIcon } from "@primer/octicons-react"; export default function ({ content, @@ -41,21 +41,22 @@ export default function ({ typeof document === "undefined" ? "" : ` -import ReactDOM from "react-dom"; +import ReactDOM from "react-dom/client"; ${content} // render element - -ReactDOM.render( - ${componentDefinition || `<${componentName} />`}, - document.getElementById('root') +const container = document.createElement("div"); +document.body.appendChild(container); +const root = ReactDOM.createRoot(container) +root.render( + ${componentDefinition || `<${componentName} />`} ) `; return ( -
-
+
+
+
@@ -202,7 +203,11 @@ const AnnotationSetList = ({ ); return ( -
+
{ @@ -257,7 +262,7 @@ const AnnotationSetList = ({ Save new annotation set
-
+
Saved annotation sets
{saved.map((annotationSet, index) => {