Skip to content

Commit e8e2b82

Browse files
committed
feat: add separator preset
1 parent 20b4fc8 commit e8e2b82

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

packages/react/src/editor/PanelRight/PanelRight.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { FC, ReactNode } from 'react';
2+
import { Separator } from '../../preset';
23
import { getClassNameFactory } from '../../utils';
34
import { ActiveBlockControl } from '../ActiveBlockControl';
45
import { type EditMode, EditorControl } from '../EditorControl';
@@ -24,6 +25,7 @@ export const PanelRight: FC<Props> = ({ mode, setMode, renderControl, onSubmit }
2425
onSubmit={onSubmit}
2526
/>
2627
<ActiveBlockControl />
28+
<Separator orientation="horizontal" />
2729
<PropertyLibrary />
2830
<Outline />
2931
</section>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.separator {
2+
background-color: var(--composify-palette-outline);
3+
flex-shrink: 0;
4+
}
5+
6+
.separator--orientation-horizontal {
7+
height: 1px;
8+
width: 100%;
9+
}
10+
11+
.separator--orientation-vertical {
12+
width: 1px;
13+
height: 100%;
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { FC, PropsWithChildren } from 'react';
2+
import { createVariants } from '../../utils';
3+
import styles from './Separator.module.css';
4+
5+
const variants = createVariants(styles);
6+
7+
type Props = PropsWithChildren<{
8+
className?: string;
9+
orientation: 'horizontal' | 'vertical';
10+
}>;
11+
12+
export const Separator: FC<Props> = ({ className, orientation, ...props }) => (
13+
<div className={variants('separator', { className, orientation })} {...props} />
14+
);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { MoveHorizontalIcon, MoveVerticalIcon } from 'lucide-react';
2+
import { Catalog } from '../../renderer';
3+
import { Separator } from './Separator';
4+
5+
Catalog.register('Separator', {
6+
component: Separator,
7+
category: 'Layout',
8+
props: {
9+
orientation: {
10+
label: 'Orientation',
11+
type: 'radio',
12+
options: [
13+
{
14+
label: <MoveHorizontalIcon />,
15+
value: 'horizontal',
16+
},
17+
{
18+
label: <MoveVerticalIcon />,
19+
value: 'vertical',
20+
},
21+
],
22+
default: 'horizontal',
23+
},
24+
},
25+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './SeparatorCatalog';
2+
3+
export { Separator } from './Separator';

packages/react/src/preset/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export { IconButton } from './IconButton';
44
export { Input } from './Input';
55
export { Segment } from './Segment';
66
export { Select } from './Select';
7+
export { Separator } from './Separator';
78
export { Text } from './Text';
89
export { Textarea } from './Textarea';
910
export { VStack } from './VStack';

0 commit comments

Comments
 (0)