mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-24 10:35:20 -06:00
feat: Added ColorPicker component to Storybook (#3019)
This commit is contained in:
44
packages/ui/ColorPicker/stories.tsx
Normal file
44
packages/ui/ColorPicker/stories.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { useArgs } from "@storybook/preview-api";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { fn } from "@storybook/test";
|
||||
import { ColorPicker } from "./index";
|
||||
|
||||
const meta: Meta<typeof ColorPicker> = {
|
||||
title: "ui/ColorPicker",
|
||||
component: ColorPicker,
|
||||
tags: ["autodocs"],
|
||||
parameters: {
|
||||
layout: "centered",
|
||||
},
|
||||
decorators: [
|
||||
function Component(Story, ctx) {
|
||||
const [, setArgs] = useArgs<typeof ctx.args>();
|
||||
|
||||
const handleChange = (newColor: string) => {
|
||||
ctx.args.onChange?.(newColor);
|
||||
setArgs({ color: newColor });
|
||||
};
|
||||
|
||||
return <Story args={{ ...ctx.args, onChange: handleChange }} />;
|
||||
},
|
||||
],
|
||||
argTypes: {
|
||||
color: {
|
||||
control: "color",
|
||||
},
|
||||
},
|
||||
args: {
|
||||
onChange: fn(),
|
||||
},
|
||||
} satisfies Meta<typeof ColorPicker>;
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
color: "#f24768",
|
||||
containerClass: "mb-20",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user