Skip to content

Commit

Permalink
Add Separator component (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
psirenny authored Aug 28, 2024
1 parent f2722af commit f704153
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/storybook/src/components/separator/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Separator } from "@spear-ai/ui/components/separator";
import type { Meta, StoryObj } from "@storybook/react";

const PreviewSeparator = () => (
<div className="w-full max-w-xs">
<Separator />
</div>
);

const meta = {
component: PreviewSeparator,
} satisfies Meta<typeof PreviewSeparator>;

type Story = StoryObj<typeof meta>;

export const Standard: Story = {
parameters: {
layout: "centered",
},
};

export default meta;
14 changes: 14 additions & 0 deletions packages/ui/src/components/separator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { forwardRef, HTMLAttributes } from "react";
import { cx } from "@/helpers/cx";

export const Separator = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ className, ...properties }, reference) => {
const mergedClassName = cx(
"before:bg-neutral-a-6 h-px w-full before:-mt-px before:block before:h-px before:w-full before:content-['']",
className,
);
return <div className={mergedClassName} {...properties} ref={reference} />;
},
);

Separator.displayName = "Separator";

0 comments on commit f704153

Please sign in to comment.