Add DocsGPTWidget embedding support for HTML

This commit is contained in:
ilyasosman
2024-05-19 22:08:18 +03:00
parent 6753b55160
commit d8720d0849
5 changed files with 360 additions and 32 deletions

View File

@@ -1,6 +1,10 @@
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import React from 'react';
const root = createRoot(document.getElementById('app') as HTMLElement);
import { DocsGPTWidget } from './components/DocsGPTWidget';
root.render(<App />);
const renderWidget = (elementId: string, props = {}) => {
const root = createRoot(document.getElementById(elementId) as HTMLElement);
root.render(<DocsGPTWidget {...props} />);
};
(window as any).renderDocsGPTWidget = renderWidget;