Skip to content

Commit de7f36b

Browse files
committed
docs: add stories for CopyButton component
1 parent 0418ec6 commit de7f36b

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
3+
import { CopyButton as CopyButtonComponent } from "./index.jsx";
4+
5+
const meta = {
6+
component: CopyButtonComponent,
7+
argTypes: {
8+
text: {
9+
control: "text",
10+
description: "The text to copy to clipboard",
11+
table: {
12+
category: "Content",
13+
},
14+
},
15+
iconOnly: {
16+
control: "boolean",
17+
description: "Show only the copy icon without text",
18+
table: {
19+
category: "Display",
20+
},
21+
},
22+
children: {
23+
control: "text",
24+
description: "Custom button text (defaults to 'Copy')",
25+
table: {
26+
category: "Content",
27+
},
28+
},
29+
isDisabled: {
30+
control: "boolean",
31+
table: {
32+
category: "State",
33+
},
34+
},
35+
},
36+
tags: ["autodocs"],
37+
} satisfies Meta<typeof CopyButtonComponent>;
38+
export default meta;
39+
40+
export const Default = {
41+
args: {
42+
text: "This text will be copied to clipboard",
43+
},
44+
} satisfies StoryObj<typeof CopyButtonComponent>;
45+
46+
export const IconOnly = {
47+
args: {
48+
text: "Icon only copy button",
49+
iconOnly: true,
50+
},
51+
} satisfies StoryObj<typeof CopyButtonComponent>;
52+
53+
export const CodeSnippet = {
54+
args: {
55+
text: "npm install @pythnetwork/component-library",
56+
children: "Copy Command",
57+
},
58+
} satisfies StoryObj<typeof CopyButtonComponent>;
59+
60+
export const Disabled = {
61+
args: {
62+
text: "This cannot be copied",
63+
isDisabled: true,
64+
},
65+
} satisfies StoryObj<typeof CopyButtonComponent>;

0 commit comments

Comments
 (0)