refactor: rename renderTopRight prop to renderTopRightUI (#3572)

* refactor: rename renderTopRight prop to renderTopRightUI

* update

* fix

* update
This commit is contained in:
Aakansha Doshi 2021-05-13 21:02:59 +05:30 committed by GitHub
parent bec34f2d57
commit 3b9290831a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 13 deletions

View File

@ -452,7 +452,7 @@ class App extends React.Component<AppProps, AppState> {
const { const {
onCollabButtonClick, onCollabButtonClick,
onExportToBackend, onExportToBackend,
renderTopRight, renderTopRightUI,
renderFooter, renderFooter,
renderCustomStats, renderCustomStats,
} = this.props; } = this.props;
@ -493,7 +493,7 @@ class App extends React.Component<AppProps, AppState> {
langCode={getLanguage().code} langCode={getLanguage().code}
isCollaborating={this.props.isCollaborating || false} isCollaborating={this.props.isCollaborating || false}
onExportToBackend={onExportToBackend} onExportToBackend={onExportToBackend}
renderTopRight={renderTopRight} renderTopRightUI={renderTopRightUI}
renderCustomFooter={renderFooter} renderCustomFooter={renderFooter}
viewModeEnabled={viewModeEnabled} viewModeEnabled={viewModeEnabled}
showExitZenModeBtn={ showExitZenModeBtn={

View File

@ -67,7 +67,7 @@ interface LayerUIProps {
appState: AppState, appState: AppState,
canvas: HTMLCanvasElement | null, canvas: HTMLCanvasElement | null,
) => void; ) => void;
renderTopRight?: (isMobile: boolean, appState: AppState) => JSX.Element; renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;
renderCustomFooter?: (isMobile: boolean) => JSX.Element; renderCustomFooter?: (isMobile: boolean) => JSX.Element;
viewModeEnabled: boolean; viewModeEnabled: boolean;
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"]; libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
@ -371,7 +371,7 @@ const LayerUI = ({
toggleZenMode, toggleZenMode,
isCollaborating, isCollaborating,
onExportToBackend, onExportToBackend,
renderTopRight, renderTopRightUI,
renderCustomFooter, renderCustomFooter,
viewModeEnabled, viewModeEnabled,
libraryReturnUrl, libraryReturnUrl,
@ -627,7 +627,7 @@ const LayerUI = ({
</Tooltip> </Tooltip>
))} ))}
</UserList> </UserList>
{renderTopRight?.(isMobile, appState)} {renderTopRightUI?.(isMobile, appState)}
</div> </div>
</div> </div>
</FixedSideContainer> </FixedSideContainer>

View File

@ -304,7 +304,7 @@ const ExcalidrawWrapper = () => {
} }
}; };
const renderTopRight = useCallback( const renderTopRightUI = useCallback(
(isMobile: boolean, appState: AppState) => { (isMobile: boolean, appState: AppState) => {
return ( return (
<div <div
@ -399,7 +399,7 @@ const ExcalidrawWrapper = () => {
isCollaborating={collabAPI?.isCollaborating()} isCollaborating={collabAPI?.isCollaborating()}
onPointerUpdate={collabAPI?.onPointerUpdate} onPointerUpdate={collabAPI?.onPointerUpdate}
onExportToBackend={onExportToBackend} onExportToBackend={onExportToBackend}
renderTopRight={renderTopRight} renderTopRightUI={renderTopRightUI}
renderFooter={renderFooter} renderFooter={renderFooter}
langCode={langCode} langCode={langCode}
renderCustomStats={renderCustomStats} renderCustomStats={renderCustomStats}

View File

@ -18,7 +18,7 @@ Please add the latest change on the top under the correct section.
### Features ### Features
- Expose [`serializeAsJSON`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#serializeAsJSON) helper that we use when saving Excalidraw scene to a file [#3538](https://github.com/excalidraw/excalidraw/pull/3538). - Expose [`serializeAsJSON`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#serializeAsJSON) helper that we use when saving Excalidraw scene to a file [#3538](https://github.com/excalidraw/excalidraw/pull/3538).
- Add support to render custom UI in the top right corner via [`renderTopRight`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRight) prop [#3539](https://github.com/excalidraw/excalidraw/pull/3539). - Add support to render custom UI in the top right corner via [`renderTopRightUI`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#renderTopRightUI) prop [#3539](https://github.com/excalidraw/excalidraw/pull/3539), [#3572](https://github.com/excalidraw/excalidraw/pull/3572) .
This also removes the GitHub icon, keeping it local to the https://excalidraw.com app. This also removes the GitHub icon, keeping it local to the https://excalidraw.com app.

View File

@ -355,7 +355,7 @@ To view the full example visit :point_down:
| [`onPointerUpdate`](#onPointerUpdate) | Function | | Callback triggered when mouse pointer is updated. | | [`onPointerUpdate`](#onPointerUpdate) | Function | | Callback triggered when mouse pointer is updated. |
| [`onExportToBackend`](#onExportToBackend) | Function | | Callback triggered when link button is clicked on export dialog | | [`onExportToBackend`](#onExportToBackend) | Function | | Callback triggered when link button is clicked on export dialog |
| [`langCode`](#langCode) | string | `en` | Language code string | | [`langCode`](#langCode) | string | `en` | Language code string |
| [`renderTopRight `](#renderTopRight) | Function | | Function that renders custom UI in top right corner | | [`renderTopRightUI`](#renderTopRightUI) | Function | | Function that renders custom UI in top right corner |
| [`renderFooter `](#renderFooter) | Function | | Function that renders custom UI footer | | [`renderFooter `](#renderFooter) | Function | | Function that renders custom UI footer |
| [`renderCustomStats`](#renderCustomStats) | Function | | Function that can be used to render custom stats on the stats dialog. | | [`renderCustomStats`](#renderCustomStats) | Function | | Function that can be used to render custom stats on the stats dialog. |
| [`viewModeEnabled`](#viewModeEnabled) | boolean | | This implies if the app is in view mode. | | [`viewModeEnabled`](#viewModeEnabled) | boolean | | This implies if the app is in view mode. |
@ -503,7 +503,7 @@ import { defaultLang, languages } from "@excalidraw/excalidraw";
| defaultLang | string | | defaultLang | string |
| languages | [Language[]](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L8) | | languages | [Language[]](https://github.com/excalidraw/excalidraw/blob/master/src/i18n.ts#L8) |
#### `renderTopRight` #### `renderTopRightUI`
A function returning JSX to render custom UI in the top right corner of the app. A function returning JSX to render custom UI in the top right corner of the app.

View File

@ -20,7 +20,7 @@ const Excalidraw = (props: ExcalidrawProps) => {
isCollaborating, isCollaborating,
onPointerUpdate, onPointerUpdate,
onExportToBackend, onExportToBackend,
renderTopRight, renderTopRightUI,
renderFooter, renderFooter,
langCode = defaultLang.code, langCode = defaultLang.code,
viewModeEnabled, viewModeEnabled,
@ -73,7 +73,7 @@ const Excalidraw = (props: ExcalidrawProps) => {
isCollaborating={isCollaborating} isCollaborating={isCollaborating}
onPointerUpdate={onPointerUpdate} onPointerUpdate={onPointerUpdate}
onExportToBackend={onExportToBackend} onExportToBackend={onExportToBackend}
renderTopRight={renderTopRight} renderTopRightUI={renderTopRightUI}
renderFooter={renderFooter} renderFooter={renderFooter}
langCode={langCode} langCode={langCode}
viewModeEnabled={viewModeEnabled} viewModeEnabled={viewModeEnabled}

View File

@ -182,7 +182,7 @@ export interface ExcalidrawProps {
data: ClipboardData, data: ClipboardData,
event: ClipboardEvent | null, event: ClipboardEvent | null,
) => Promise<boolean> | boolean; ) => Promise<boolean> | boolean;
renderTopRight?: (isMobile: boolean, appState: AppState) => JSX.Element; renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element;
renderFooter?: (isMobile: boolean) => JSX.Element; renderFooter?: (isMobile: boolean) => JSX.Element;
langCode?: Language["code"]; langCode?: Language["code"];
viewModeEnabled?: boolean; viewModeEnabled?: boolean;