[WEB-4740] feat: add propel seperator (#7637)

* chore: global css file added to tailwind config package

* chore: tailwind config updated

* chore: cn utility function added to propel package

* chore: storybook init

* fix: format error

* chore: code refactor

* chore: code refactor

* fix: format error

* feat: add propel seperator component

* 🔒 chore: updated lock file

* ✏️ fix: typo in separator filename and some linting issues

* ♻️ refactor: replace clsx with cn utility in Separator component for class name management

* 🐛 fix: re-added twMerge

* 🧹 cleanup: remove unnecessary blank line in Separator component

---------

Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so>
This commit is contained in:
Jayash Tripathy
2025-09-01 19:40:01 +05:30
committed by GitHub
parent 34181fba80
commit 64b95daff4
2 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Separator } from "./separator";
const meta: Meta<typeof Separator> = {
title: "Components/Separator",
component: Separator,
parameters: {
layout: "centered",
},
tags: ["autodocs"],
};
export default meta;
type Story = StoryObj<typeof Separator>;
export const Default: Story = {
render: () => (
<div className="w-[300px] space-y-4">
<div>Content Above</div>
<Separator />
<div>Content Below</div>
</div>
),
};
export const Vertical: Story = {
render: () => (
<div className="flex h-[100px] items-center space-x-4">
<div>Left Content</div>
<Separator orientation="vertical" />
<div>Right Content</div>
</div>
),
};
export const WithinContainer: Story = {
render: () => (
<div className="w-[300px] rounded-lg border p-6 space-y-4">
<div className="space-y-2">
<h4 className="font-medium leading-none">Section 1</h4>
<p className="text-sm text-muted-foreground">Description for section 1</p>
</div>
<Separator />
<div className="space-y-2">
<h4 className="font-medium leading-none">Section 2</h4>
<p className="text-sm text-muted-foreground">Description for section 2</p>
</div>
</div>
),
};

View File

@@ -0,0 +1,29 @@
import * as React from "react";
import { Separator as SeparatorPrimitive } from "@base-ui-components/react/separator";
import { cn } from "../utils";
interface SeparatorProps extends React.ComponentProps<typeof SeparatorPrimitive> {
/**
* The orientation of the separator
* @default "horizontal"
*/
orientation?: "horizontal" | "vertical";
}
const Separator = React.forwardRef<React.ElementRef<typeof SeparatorPrimitive>, SeparatorProps>(
({ orientation = "horizontal", ...props }, ref) => (
<SeparatorPrimitive
ref={ref}
orientation={orientation}
data-slot="separator"
data-orientation={orientation}
{...props}
className={cn("bg-custom-border-200", "shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px")}
/>
)
);
Separator.displayName = "Separator";
export { Separator };
export type { SeparatorProps };