Skip to content

Commit

Permalink
docs: adding ButtonLink to API docs (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
aversini authored Dec 17, 2024
1 parent 9b1e950 commit 4aa79fb
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/api/src/stories/ButtonLink.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Meta } from "@storybook/blocks";

import AutoDoc from "../helpers/AutoDoc";
import * as Stories from "./ButtonLink.stories";

<Meta title="Components/ButtonLink" of={Stories} />
<AutoDoc importName="ButtonLink" importPackage="ui-button" stage="stable" />
69 changes: 69 additions & 0 deletions packages/api/src/stories/ButtonLink.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import type { Meta, StoryObj } from "@storybook/react";
import { fn } from "@storybook/test";

import { ButtonLink } from "@versini/ui-button/src/components";

type Story = StoryObj<typeof ButtonLink>;

const meta: Meta<typeof ButtonLink> = {
parameters: {
layout: "centered",
docs: {
controls: { exclude: ["spacing"] },
},
},
title: "Components/ButtonLink",

component: ButtonLink,
args: { onClick: fn() },
};

export default meta;

export const Basic: Story = {
render: (args) => (
<div className="flex flex-wrap gap-2">
<ButtonLink {...args}>Anchor as a button</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum dolor</ButtonLink>
<ButtonLink {...args}>
Anchor as a button lorem ipsum dolor sit amet
</ButtonLink>
</div>
),
};

export const NewWindow: Story = {
args: { target: "_blank" },
render: (args) => (
<div className="flex flex-wrap gap-2">
<ButtonLink {...args}>Anchor as a button</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum dolor</ButtonLink>
<ButtonLink {...args}>
Anchor as a button lorem ipsum dolor sit amet
</ButtonLink>
</div>
),
};

export const Truncate: Story = {
args: { className: "w-44 sm:w-52" },
render: (args) => (
<>
<div className="flex flex-wrap gap-2">
<ButtonLink {...args}>Anchor as a button</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum</ButtonLink>
<ButtonLink {...args}>Anchor as a button lorem ipsum dolor</ButtonLink>
<ButtonLink {...args}>
Anchor as a button lorem ipsum dolor sit amet
</ButtonLink>
</div>
<div className="pt-4">
<p>For text to truncate, you need to limit the width of the buttons.</p>
<p>This can be done by using Tailwind width classes, for example</p>
<code>className={args.className}</code>
</div>
</>
),
};

0 comments on commit 4aa79fb

Please sign in to comment.