feat: render unknown supplied children to UI (#6096)

This commit is contained in:
David Luzar 2023-01-12 15:20:16 +01:00 committed by GitHub
parent 699897f71b
commit 0982da38fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 24 deletions

View file

@ -15,11 +15,7 @@ import {
BinaryFiles,
UIChildrenComponents,
} from "../types";
import {
isShallowEqual,
muteFSAbortError,
ReactChildrenToObject,
} from "../utils";
import { isShallowEqual, muteFSAbortError, getReactChildren } from "../utils";
import { SelectedShapeActions, ShapesSwitcher } from "./Actions";
import CollabButton from "./CollabButton";
import { ErrorDialog } from "./ErrorDialog";
@ -111,8 +107,11 @@ const LayerUI = ({
}: LayerUIProps) => {
const device = useDevice();
const childrenComponents =
ReactChildrenToObject<UIChildrenComponents>(children);
const [childrenComponents, restChildren] =
getReactChildren<UIChildrenComponents>(children, {
Menu: true,
FooterCenter: true,
});
const renderJSONExportDialog = () => {
if (!UIOptions.canvasActions.export) {
@ -390,6 +389,7 @@ const LayerUI = ({
return (
<>
{restChildren}
{appState.isLoading && <LoadingMessage delay={250} />}
{appState.errorMessage && (
<ErrorDialog