Skip to content

Visualize Your Ideas With Code

refactor(ui): unify sidebar panels (#695)

Jacobb77d87d51444
diff --git a/packages/ui/src/components/controls/Separator.tsx b/packages/ui/src/components/controls/Separator.tsx
index faa15335..3fc2733c 100644
--- a/packages/ui/src/components/controls/Separator.tsx
+++ b/packages/ui/src/components/controls/Separator.tsx
@@ -1,15 +1,16 @@
import type {JSX} from 'preact';
-import styles from './Controls.module.scss';
-import clsx from 'clsx';
+export interface SeparatorProps extends JSX.HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
-export function Separator({
- className,
- ...props
-}: JSX.HTMLAttributes<HTMLDivElement>) {
+export function Separator({size = 2, ...props}: SeparatorProps) {
return (
- <div className={clsx(styles.separator, className)} {...props}>
- {props.children}
- </div>
+ <div
+ {...props}
+ style={{
+ height: size * 8,
+ }}
+ />
);
}
diff --git a/packages/ui/src/components/fields/Expandable.module.scss b/packages/ui/src/components/fields/Expandable.module.scss
index 599f18eb..e791db90 100644
--- a/packages/ui/src/components/fields/Expandable.module.scss
+++ b/packages/ui/src/components/fields/Expandable.module.scss
@@ -1,9 +1,10 @@
.root {
- border-top: 1px solid var(--background-color);
+ border-top: 2px solid var(--background-color);
+ margin-top: -1px;
}
.title {
- padding: 8px 0;
+ padding: 7px 0 8px;
user-select: none;
cursor: pointer;
diff --git a/packages/ui/src/components/sidebar/Properties.tsx b/packages/ui/src/components/sidebar/Properties.tsx
index d3ad778a..d7987870 100644
--- a/packages/ui/src/components/sidebar/Properties.tsx
+++ b/packages/ui/src/components/sidebar/Properties.tsx
@@ -5,7 +5,7 @@ import {isInspectable} from '@motion-canvas/core/lib/scenes/Inspectable';
import {Pane} from '../tabs';
import {useInspection} from '../../contexts';
import {AutoField} from '../fields';
-import {Button, Group, Label} from '../controls';
+import {Button, Group, Label, Separator} from '../controls';
import {findAndOpenFirstUserFile} from '../../utils';
export function Properties() {
@@ -29,6 +29,7 @@ export function Properties() {
return (
<Pane title="Properties" id="properties-pane">
+ <Separator size={1} />
{stack && (
<Group>
<Label />
diff --git a/packages/ui/src/components/sidebar/Sidebar.module.scss b/packages/ui/src/components/sidebar/Sidebar.module.scss
index 8c06a208..4176bd5a 100644
--- a/packages/ui/src/components/sidebar/Sidebar.module.scss
+++ b/packages/ui/src/components/sidebar/Sidebar.module.scss
@@ -6,7 +6,11 @@
}
.thread {
- padding: 4px 0;
+ padding: 8px 0;
+
+ .thread {
+ padding: 4px 0;
+ }
}
.threadTitle {