Virtual whiteboard for sketching hand-drawn like diagrams
feat: support renderTopRightUI in mobile (#4065)
Aakansha Doshic6ffc065411c
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsxindex eb3bcd5190..f08c76200e 100644--- a/src/components/LayerUI.tsx+++ b/src/components/LayerUI.tsx@@ -65,7 +65,10 @@ interface LayerUIProps {toggleZenMode: () => void;langCode: Language["code"];isCollaborating: boolean;- renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;+ renderTopRightUI?: (+ isMobile: boolean,+ appState: AppState,+ ) => JSX.Element | null;renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;viewModeEnabled: boolean;libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];@@ -761,6 +764,7 @@ const LayerUI = ({renderCustomFooter={renderCustomFooter}viewModeEnabled={viewModeEnabled}showThemeBtn={showThemeBtn}+ renderTopRightUI={renderTopRightUI}/></>) : (diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsxindex 7291301fae..1c7ecc70f5 100644--- a/src/components/MobileMenu.tsx+++ b/src/components/MobileMenu.tsx@@ -33,6 +33,10 @@ type MobileMenuProps = {renderCustomFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;viewModeEnabled: boolean;showThemeBtn: boolean;+ renderTopRightUI?: (+ isMobile: boolean,+ appState: AppState,+ ) => JSX.Element | null;};export const MobileMenu = ({@@ -50,6 +54,7 @@ export const MobileMenu = ({renderCustomFooter,viewModeEnabled,showThemeBtn,+ renderTopRightUI,}: MobileMenuProps) => {const renderToolbar = () => {return (@@ -68,6 +73,7 @@ export const MobileMenu = ({/></Stack.Row></Island>+ {renderTopRightUI && renderTopRightUI(true, appState)}<LockButtonchecked={appState.elementLocked}onChange={onLockToggle}diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsxindex adf308c274..af325c0306 100644--- a/src/excalidraw-app/index.tsx+++ b/src/excalidraw-app/index.tsx@@ -307,6 +307,9 @@ const ExcalidrawWrapper = () => {const renderTopRightUI = useCallback((isMobile: boolean, appState: AppState) => {+ if (isMobile) {+ return null;+ }return (<divstyle={{diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.mdindex 338204c1f3..b7c98d5640 100644--- a/src/packages/excalidraw/CHANGELOG.md+++ b/src/packages/excalidraw/CHANGELOG.md@@ -17,7 +17,9 @@ Please add the latest change on the top under the correct section.### Features-- Export `THEME` constant from the package so host can use this when passing the theme+- Support [`renderTopRightUI`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRightUI) in mobile UI.++- Export `THEME` constant from the package so host can use this when passing the theme.#### BREAKING CHANGEdiff --git a/src/types.ts b/src/types.tsindex dfb8362a73..543b83e705 100644--- a/src/types.ts+++ b/src/types.ts@@ -186,7 +186,10 @@ export interface ExcalidrawProps {data: ClipboardData,event: ClipboardEvent | null,) => Promise<boolean> | boolean;- renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;+ renderTopRightUI?: (+ isMobile: boolean,+ appState: AppState,+ ) => JSX.Element | null;renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element;langCode?: Language["code"];viewModeEnabled?: boolean;