Skip to content

Commit

Permalink
feat: add divider component
Browse files Browse the repository at this point in the history
  • Loading branch information
kirchoni committed Apr 6, 2024
1 parent 5386749 commit f82cfd5
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 1 deletion.
32 changes: 32 additions & 0 deletions apps/docs/data/design/material-you/components/divider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Divider
---

# Divider

The `Divider` component is used to separate content in a list or a layout.

<Demo src="/demos/material-you/divider" />

### Usage

```tsx
import { BakaDivider } from "baka-ui";

function MyComponent() {
return (
<BakaNavigation>
<BakaNavigationItem>{/* content */}</BakaNavigationItem>
<BakaNavigationItem>{/* content */}</BakaNavigationItem>
<BakaDivider />
<BakaNavigationItem>{/* content */}</BakaNavigationItem>
</BakaNavigation>
);
}
```

### Examples

#### Vertical Divider

<Demo src="/demos/material-you/divider/vertical" style={{ height: 450 }} />
2 changes: 1 addition & 1 deletion apps/docs/public/demos.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions apps/docs/src/app/demos/material-you/divider/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BakaDivider } from "baka-ui";

export default function DividerDemo() {
return <BakaDivider style={{ width: 300 }} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import type { Meta, StoryObj } from "@storybook/react";
import DividerStory, { DividerStoryProps, defaultProps } from "./page";

const meta: Meta = {
title: "Material You/Divider",
component: (props: DividerStoryProps) => <DividerStory {...props} />,
parameters: {
layout: "centered",
},
argTypes: {
children: { table: { disable: true } },
},
};

export default meta;

type Story = StoryObj<typeof meta>;
export const Basic: Story = {
args: {
...defaultProps,
},
argTypes: {
orientation: {
control: "radio",
options: ["horizontal", "vertical"],
},
},
};
19 changes: 19 additions & 0 deletions apps/docs/src/app/demos/material-you/divider/stories/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { BakaDivider, BakaDividerProps } from "baka-ui";

export type DividerStoryProps = BakaDividerProps & {
orientation?: "horizontal" | "vertical";
};

export const defaultProps: DividerStoryProps = {
orientation: "horizontal",
};

export default function DividerStoryDemo(props: DividerStoryProps) {
const args = { ...defaultProps, ...props };

return args.orientation === "horizontal" ? (
<BakaDivider style={{ width: 300 }} />
) : (
<BakaDivider style={{ width: 1, height: 300 }} />
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BakaDivider } from "baka-ui";

export default function DividerDemo() {
return <BakaDivider style={{ width: 1, height: 300 }} />;
}

0 comments on commit f82cfd5

Please sign in to comment.