-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1450 from ManishMadan2882/main
React Widget: Updating to v0.4.8
- Loading branch information
Showing
11 changed files
with
433 additions
and
57 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//exports browser ready methods | ||
|
||
import { createRoot } from "react-dom/client"; | ||
|
||
import { DocsGPTWidget } from './components/DocsGPTWidget'; | ||
import { SearchBar } from './components/SearchBar'; | ||
import React from "react"; | ||
if (typeof window !== 'undefined') { | ||
const renderWidget = (elementId: string, props = {}) => { | ||
const root = createRoot(document.getElementById(elementId) as HTMLElement); | ||
root.render(<DocsGPTWidget {...props} />); | ||
}; | ||
const renderSearchBar = (elementId: string, props = {}) => { | ||
const root = createRoot(document.getElementById(elementId) as HTMLElement); | ||
root.render(<SearchBar {...props} />); | ||
}; | ||
(window as any).renderDocsGPTWidget = renderWidget; | ||
|
||
(window as any).renderSearchBar = renderSearchBar; | ||
} | ||
|
||
export { DocsGPTWidget, SearchBar }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
//exports methods for React | ||
export {SearchBar} from "./components/SearchBar" | ||
export { DocsGPTWidget } from "./components/DocsGPTWidget"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,7 @@ | ||
|
||
//development | ||
import { createRoot } from "react-dom/client"; | ||
import { App } from "./App"; | ||
import { DocsGPTWidget } from './components/DocsGPTWidget'; | ||
import { SearchBar } from './components/SearchBar'; | ||
import React from "react"; | ||
if (typeof window !== 'undefined') { | ||
const renderWidget = (elementId: string, props = {}) => { | ||
const root = createRoot(document.getElementById(elementId) as HTMLElement); | ||
root.render(<DocsGPTWidget {...props} />); | ||
}; | ||
const renderSearchBar = (elementId: string, props = {}) => { | ||
const root = createRoot(document.getElementById(elementId) as HTMLElement); | ||
root.render(<SearchBar {...props} />); | ||
}; | ||
(window as any).renderDocsGPTWidget = renderWidget; | ||
|
||
(window as any).renderSearchBar = renderSearchBar; | ||
} | ||
const container = document.getElementById("app") as HTMLElement; | ||
const root = createRoot(container) | ||
root.render(<App />); | ||
|
||
export { DocsGPTWidget }; | ||
export { SearchBar } | ||
root.render(<App />); |