Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

sortable-tree -> tree

Roman Pominovc82a4f427e64
diff --git a/apps/designer/app/designer/features/sidebar-left/lib/navigator/navigator.tsx b/apps/designer/app/designer/features/sidebar-left/lib/navigator/navigator.tsx
index ccf56587d1..f8349bdaf1 100644
--- a/apps/designer/app/designer/features/sidebar-left/lib/navigator/navigator.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/lib/navigator/navigator.tsx
@@ -1,7 +1,7 @@
import { Flex } from "@webstudio-is/design-system";
import type { Instance, Publish } from "@webstudio-is/react-sdk";
import { useSelectedInstanceData } from "~/designer/shared/nano-states";
-import { SortableTree } from "~/designer/shared/tree";
+import { Tree } from "~/designer/shared/tree";
import { useRootInstance } from "~/shared/nano-states";
import { Header } from "../header";
@@ -20,7 +20,7 @@ export const Navigator = ({ publish, isClosable, onClose }: NavigatorProps) => {
<Flex css={{ height: "100%", flexDirection: "column" }}>
<Header title="Navigator" onClose={onClose} isClosable={isClosable} />
<Flex css={{ flexGrow: 1, flexDirection: "column" }}>
- <SortableTree
+ <Tree
root={rootInstance}
selectedInstanceId={selectedInstanceData?.id}
onSelect={(instance) => {
diff --git a/apps/designer/app/designer/shared/tree/index.ts b/apps/designer/app/designer/shared/tree/index.ts
index be397a1a5a..040ff37e1a 100644
--- a/apps/designer/app/designer/shared/tree/index.ts
+++ b/apps/designer/app/designer/shared/tree/index.ts
@@ -1,2 +1,2 @@
-export * from "./sortable-tree";
+export * from "./tree";
export * from "./tree-node";
diff --git a/apps/designer/app/designer/shared/tree/sortable-tree.stories.tsx b/apps/designer/app/designer/shared/tree/sortable-tree.stories.tsx
index 34fce907cd..e5144e8ca6 100644
--- a/apps/designer/app/designer/shared/tree/sortable-tree.stories.tsx
+++ b/apps/designer/app/designer/shared/tree/sortable-tree.stories.tsx
@@ -3,7 +3,7 @@ import { Instance } from "@webstudio-is/react-sdk";
import { useState } from "react";
import produce from "immer";
import { createInstance, reparentInstanceMutable } from "~/shared/tree-utils";
-import { SortableTree } from "./sortable-tree";
+import { Tree } from "./tree";
import { Flex } from "@webstudio-is/design-system";
export const StressTest = ({ animate }: { animate: boolean }) => {
@@ -46,7 +46,7 @@ export const StressTest = ({ animate }: { animate: boolean }) => {
return (
<Flex css={{ width: 300, height: 500, flexDirection: "column" }}>
- <SortableTree
+ <Tree
animate={animate}
root={root}
selectedInstanceId={selectedInstanceId}
@@ -70,4 +70,4 @@ export const StressTest = ({ animate }: { animate: boolean }) => {
export default {
args: { animate: true },
-} as ComponentMeta<typeof SortableTree>;
+} as ComponentMeta<typeof Tree>;
diff --git a/apps/designer/app/designer/shared/tree/sortable-tree.tsx b/apps/designer/app/designer/shared/tree/tree.tsx
similarity index 98%
rename from apps/designer/app/designer/shared/tree/sortable-tree.tsx
rename to apps/designer/app/designer/shared/tree/tree.tsx
index 26031cf644..a79918140b 100644
--- a/apps/designer/app/designer/shared/tree/sortable-tree.tsx
+++ b/apps/designer/app/designer/shared/tree/tree.tsx
@@ -25,7 +25,6 @@ import {
getPlacementIndicatorAlignment,
INDENT,
} from "./tree-node";
-import { CSSProperties } from "@stitches/react";
import {
PlacementIndicatorLine,
PlacementIndicatorOutline,
@@ -36,21 +35,19 @@ type TreeProps = {
selectedInstanceId?: Instance["id"];
onSelect?: (instance: Instance) => void;
animate?: boolean;
+ onDragEnd: (event: {
+ instanceId: Instance["id"];
+ dropTarget: { instanceId: Instance["id"]; position: number | "end" };
+ }) => void;
};
-export const SortableTree = ({
+export const Tree = ({
root,
selectedInstanceId,
onSelect,
animate,
onDragEnd,
-}: TreeProps & {
- onDragEnd: (event: {
- instanceId: Instance["id"];
- dropTarget: { instanceId: Instance["id"]; position: number | "end" };
- }) => void;
- height?: CSSProperties["height"];
-}) => {
+}: TreeProps) => {
const { getIsExpanded, setIsExpanded } = useExpandState({
root,
selectedInstanceId,