frontAnswerer/src/widget.tsx
Nastya 1c4f15d124
All checks were successful
Deploy / CreateImage (push) Successful in 4m38s
Deploy / DeployService (push) Successful in 24s
--
2025-07-01 16:12:22 +03:00

34 lines
770 B
TypeScript

import QuizAnswerer from "@/components/QuizAnswerer";
import { createRoot } from "react-dom/client";
// eslint-disable-next-line react-refresh/only-export-components
export * from "./widgets";
import "./i18n/i18nWidget";
// old widget
const widget = {
create({
selector,
quizId,
changeFaviconAndTitle = true,
}: {
selector: string;
quizId: string;
changeFaviconAndTitle: boolean;
}) {
const element = document.getElementById(selector);
if (!element) throw new Error("Element for widget doesn't exist");
const root = createRoot(element);
root.render(
<QuizAnswerer
quizId={quizId}
changeFaviconAndTitle={changeFaviconAndTitle}
disableGlobalCss
/>
);
},
};
export default widget;