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.

header for sidebar panels

Oleg Isonen713b509c88fc
diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx
index 0b210fd487..5c5f712482 100644
--- a/apps/designer/app/designer/designer.tsx
+++ b/apps/designer/app/designer/designer.tsx
@@ -36,7 +36,7 @@ import {
useDragAndDropState,
} from "~/shared/nano-states";
import { useSubscribeClientSetting } from "./shared/client-settings";
-import { Navigator } from "./features/navigator";
+import { Navigator } from "./features/sidebar-left";
export const links = () => {
return [
diff --git a/apps/designer/app/designer/features/navigator/navigator.tsx b/apps/designer/app/designer/features/navigator/navigator.tsx
deleted file mode 100644
index e2fde4c9b8..0000000000
--- a/apps/designer/app/designer/features/navigator/navigator.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import type { Instance, Publish } from "@webstudio-is/react-sdk";
-import { useSelectedInstancePath } from "~/designer/shared/instance/use-selected-instance-path";
-import { useSelectedInstanceData } from "~/designer/shared/nano-states";
-import { Tree } from "~/designer/shared/tree";
-import { useRootInstance } from "~/shared/nano-states";
-
-type NavigatorProps = {
- publish: Publish;
-};
-
-export const Navigator = ({ publish }: NavigatorProps) => {
- const [selectedInstanceData] = useSelectedInstanceData();
- const [rootInstance] = useRootInstance();
- const selectedInstancePath = useSelectedInstancePath(
- selectedInstanceData?.id
- );
-
- if (rootInstance === undefined) return null;
- return (
- <Tree
- instance={rootInstance}
- selectedInstancePath={selectedInstancePath}
- selectedInstanceId={selectedInstanceData?.id}
- onSelect={(instance) => {
- publish<"selectInstanceById", Instance["id"]>({
- type: "selectInstanceById",
- payload: instance.id,
- });
- }}
- />
- );
-};
diff --git a/apps/designer/app/designer/features/sidebar-left/index.tsx b/apps/designer/app/designer/features/sidebar-left/index.tsx
index e403e34164..e996490006 100644
--- a/apps/designer/app/designer/features/sidebar-left/index.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/index.tsx
@@ -1 +1,2 @@
export { SidebarLeft } from "./sidebar-left";
+export { Navigator } from "./navigator";
diff --git a/apps/designer/app/designer/features/navigator/index.ts b/apps/designer/app/designer/features/sidebar-left/navigator/index.ts
similarity index 100%
rename from apps/designer/app/designer/features/navigator/index.ts
rename to apps/designer/app/designer/features/sidebar-left/navigator/index.ts
diff --git a/apps/designer/app/designer/features/sidebar-left/navigator/navigator.tsx b/apps/designer/app/designer/features/sidebar-left/navigator/navigator.tsx
new file mode 100644
index 0000000000..14c0998eba
--- /dev/null
+++ b/apps/designer/app/designer/features/sidebar-left/navigator/navigator.tsx
@@ -0,0 +1,40 @@
+import { Box } from "@webstudio-is/design-system";
+import type { Instance, Publish } from "@webstudio-is/react-sdk";
+import { useSelectedInstancePath } from "~/designer/shared/instance/use-selected-instance-path";
+import { useSelectedInstanceData } from "~/designer/shared/nano-states";
+import { Tree } from "~/designer/shared/tree";
+import { useRootInstance } from "~/shared/nano-states";
+import { Header } from "../lib/header";
+
+type NavigatorProps = {
+ publish: Publish;
+ onClose?: () => void;
+};
+
+export const Navigator = ({ publish, onClose }: NavigatorProps) => {
+ const [selectedInstanceData] = useSelectedInstanceData();
+ const [rootInstance] = useRootInstance();
+ const selectedInstancePath = useSelectedInstancePath(
+ selectedInstanceData?.id
+ );
+
+ if (rootInstance === undefined) return null;
+ return (
+ <>
+ <Header title="Navigator" onClose={onClose} />
+ <Box css={{ padding: "$1" }}>
+ <Tree
+ instance={rootInstance}
+ selectedInstancePath={selectedInstancePath}
+ selectedInstanceId={selectedInstanceData?.id}
+ onSelect={(instance) => {
+ publish<"selectInstanceById", Instance["id"]>({
+ type: "selectInstanceById",
+ payload: instance.id,
+ });
+ }}
+ />
+ </Box>
+ </>
+ );
+};
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/navigator.tsx b/apps/designer/app/designer/features/sidebar-left/panels/navigator.tsx
index c61e36d199..d1cd647f4e 100644
--- a/apps/designer/app/designer/features/sidebar-left/panels/navigator.tsx
+++ b/apps/designer/app/designer/features/sidebar-left/panels/navigator.tsx
@@ -1,13 +1,22 @@
import { type Publish } from "@webstudio-is/react-sdk";
import { ListNestedIcon } from "@webstudio-is/icons";
-import { Navigator } from "~/designer/features/navigator";
+import { Navigator } from "../navigator";
+import { TabName } from "../types";
type TabContentProps = {
publish: Publish;
+ onSetActiveTab: (tabName: TabName) => void;
};
-export const TabContent = ({ publish }: TabContentProps) => {
- return <Navigator publish={publish} />;
+export const TabContent = ({ publish, onSetActiveTab }: TabContentProps) => {
+ return (
+ <Navigator
+ publish={publish}
+ onClose={() => {
+ onSetActiveTab("none");
+ }}
+ />
+ );
};
export const icon = <ListNestedIcon />;
diff --git a/apps/designer/app/designer/shared/tree/tree.tsx b/apps/designer/app/designer/shared/tree/tree.tsx
index a4aaf943c2..5200890d10 100644
--- a/apps/designer/app/designer/shared/tree/tree.tsx
+++ b/apps/designer/app/designer/shared/tree/tree.tsx
@@ -123,7 +123,7 @@ export const Tree = ({
}}
>
<Icon />
- <Text>{label}</Text>
+ <Text size="1">{label}</Text>
</Button>
</Flex>
{children != null && <CollapsibleContent>{children}</CollapsibleContent>}
diff --git a/packages/design-system/src/components/separator.tsx b/packages/design-system/src/components/separator.tsx
index b0999f78de..f491d0c4e3 100644
--- a/packages/design-system/src/components/separator.tsx
+++ b/packages/design-system/src/components/separator.tsx
@@ -5,7 +5,7 @@ export const Separator = styled(SeparatorPrimitive.Root, {
border: "none",
margin: 0,
flexShrink: 0,
- backgroundColor: "$slate6",
+ backgroundColor: "$slate7",
cursor: "default",
variants: {
@@ -32,9 +32,18 @@ export const Separator = styled(SeparatorPrimitive.Root, {
height: "$7",
},
},
+ auto: {
+ '&[data-orientation="horizontal"]': {
+ height: "1px",
+ },
+
+ '&[data-orientation="vertical"]': {
+ width: "1px",
+ },
+ },
},
},
defaultVariants: {
- size: "1",
+ size: "auto",
},
});
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index 26c115a71f..a1e17d0d5d 100644
--- a/packages/design-system/src/index.ts
+++ b/packages/design-system/src/index.ts
@@ -61,3 +61,4 @@ export * from "./components/combobox";
export * from "./components/checkbox";
export * from "./components/avatar";
export * from "./components/primitives/dnd";
+export * from "./components/separator";
diff --git a/packages/design-system/src/stitches.config.ts b/packages/design-system/src/stitches.config.ts
index 9f5d9140fa..422d500739 100644
--- a/packages/design-system/src/stitches.config.ts
+++ b/packages/design-system/src/stitches.config.ts
@@ -209,50 +209,50 @@ export const {
sans: "Inter, -apple-system, system-ui, sans-serif",
mono: "Söhne Mono, menlo, monospace",
},
+ // space: {
+ // 1: "5px",
+ // 2: "10px",
+ // 3: "15px",
+ // 4: "20px",
+ // 5: "25px",
+ // 6: "35px",
+ // 7: "45px",
+ // 8: "65px",
+ // 9: "80px",
+ // },
+ // sizes: {
+ // 1: "5px",
+ // 2: "10px",
+ // 3: "15px",
+ // 4: "20px",
+ // 5: "25px",
+ // 6: "35px",
+ // 7: "45px",
+ // 8: "65px",
+ // 9: "80px",
+ // },
space: {
- 1: "5px",
- 2: "10px",
- 3: "15px",
+ 1: "4px",
+ 2: "8px",
+ 3: "16px",
4: "20px",
- 5: "25px",
- 6: "35px",
- 7: "45px",
- 8: "65px",
+ 5: "24px",
+ 6: "32px",
+ 7: "48px",
+ 8: "64px",
9: "80px",
},
sizes: {
- 1: "5px",
- 2: "10px",
- 3: "15px",
+ 1: "4px",
+ 2: "8px",
+ 3: "16px",
4: "20px",
- 5: "25px",
- 6: "35px",
- 7: "45px",
- 8: "65px",
+ 5: "24px",
+ 6: "32px",
+ 7: "48px",
+ 8: "64px",
9: "80px",
},
- // space: {
- // 1: '4px',
- // 2: '8px',
- // 3: '16px',
- // 4: '20px',
- // 5: '24px',
- // 6: '32px',
- // 7: '48px',
- // 8: '64px',
- // 9: '80px',
- // },
- // sizes: {
- // 1: '4px',
- // 2: '8px',
- // 3: '16px',
- // 4: '20px',
- // 5: '24px',
- // 6: '32px',
- // 7: '48px',
- // 8: '64px',
- // 9: '80px',
- // },
fontSizes: {
1: "12px",
2: "13px",