feat: Add renderCustomStats prop and expose setToastMessage API via refs to update toast (#3360)

* feat: Add renderCustomStats prop to render extra stats & move storage and version to renderCustomStats

* expose Api to update toast message so single instance of toast is used

* rename to setToastMessage

* update docs
This commit is contained in:
Aakansha Doshi 2021-03-29 20:06:34 +05:30 committed by GitHub
parent 58a7568c9f
commit 0d818f3810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 126 additions and 75 deletions

View file

@ -50,6 +50,7 @@ import {
importFromLocalStorage,
saveToLocalStorage,
} from "./data/localStorage";
import CustomStats from "./CustomStats";
const languageDetector = new LanguageDetector();
languageDetector.init({
@ -323,6 +324,14 @@ const ExcalidrawWrapper = () => {
[langCode],
);
const renderCustomStats = () => {
return (
<CustomStats
setToastMessage={(message) => excalidrawAPI!.setToastMessage(message)}
/>
);
};
return (
<>
<Excalidraw
@ -337,6 +346,7 @@ const ExcalidrawWrapper = () => {
onExportToBackend={onExportToBackend}
renderFooter={renderFooter}
langCode={langCode}
renderCustomStats={renderCustomStats}
/>
{excalidrawAPI && <CollabWrapper excalidrawAPI={excalidrawAPI} />}
{errorMessage && (