From 4aa79fb934e20bd5f7a5d0a6d12642fdebfcdeed Mon Sep 17 00:00:00 2001 From: Arno V Date: Tue, 17 Dec 2024 18:24:45 -0500 Subject: [PATCH] docs: adding ButtonLink to API docs (#760) --- packages/api/src/stories/ButtonLink.mdx | 7 ++ .../api/src/stories/ButtonLink.stories.tsx | 69 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 packages/api/src/stories/ButtonLink.mdx create mode 100644 packages/api/src/stories/ButtonLink.stories.tsx diff --git a/packages/api/src/stories/ButtonLink.mdx b/packages/api/src/stories/ButtonLink.mdx new file mode 100644 index 00000000..a0bcae7b --- /dev/null +++ b/packages/api/src/stories/ButtonLink.mdx @@ -0,0 +1,7 @@ +import { Meta } from "@storybook/blocks"; + +import AutoDoc from "../helpers/AutoDoc"; +import * as Stories from "./ButtonLink.stories"; + + + diff --git a/packages/api/src/stories/ButtonLink.stories.tsx b/packages/api/src/stories/ButtonLink.stories.tsx new file mode 100644 index 00000000..6df2d799 --- /dev/null +++ b/packages/api/src/stories/ButtonLink.stories.tsx @@ -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; + +const meta: Meta = { + parameters: { + layout: "centered", + docs: { + controls: { exclude: ["spacing"] }, + }, + }, + title: "Components/ButtonLink", + + component: ButtonLink, + args: { onClick: fn() }, +}; + +export default meta; + +export const Basic: Story = { + render: (args) => ( +
+ Anchor as a button + Anchor as a button lorem ipsum + Anchor as a button lorem ipsum dolor + + Anchor as a button lorem ipsum dolor sit amet + +
+ ), +}; + +export const NewWindow: Story = { + args: { target: "_blank" }, + render: (args) => ( +
+ Anchor as a button + Anchor as a button lorem ipsum + Anchor as a button lorem ipsum dolor + + Anchor as a button lorem ipsum dolor sit amet + +
+ ), +}; + +export const Truncate: Story = { + args: { className: "w-44 sm:w-52" }, + render: (args) => ( + <> +
+ Anchor as a button + Anchor as a button lorem ipsum + Anchor as a button lorem ipsum dolor + + Anchor as a button lorem ipsum dolor sit amet + +
+
+

For text to truncate, you need to limit the width of the buttons.

+

This can be done by using Tailwind width classes, for example

+ className={args.className} +
+ + ), +};