From 6000ff4b4838d0b6d5119ae40b84f28e46637084 Mon Sep 17 00:00:00 2001 From: "GitStart-Cal.com" <121884634+gitstart-calcom@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:16:37 +0000 Subject: [PATCH] chore: add ColorPicker in storybook (CALCOM-10760) (#10866) Co-authored-by: gitstart-calcom --- .../form/color-picker/colorpicker.stories.mdx | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 packages/ui/components/form/color-picker/colorpicker.stories.mdx diff --git a/packages/ui/components/form/color-picker/colorpicker.stories.mdx b/packages/ui/components/form/color-picker/colorpicker.stories.mdx new file mode 100644 index 0000000000..39398708b3 --- /dev/null +++ b/packages/ui/components/form/color-picker/colorpicker.stories.mdx @@ -0,0 +1,84 @@ +import { TooltipProvider } from "@radix-ui/react-tooltip"; +import { Canvas, Meta, Story } from "@storybook/addon-docs"; + +import { + Example, + Title, + CustomArgsTable, + VariantRow, + VariantsTable, +} from "@calcom/storybook/components"; + +import ColorPicker from "./colorpicker"; + + + + + +## Definitions + +`Color Picker` is used to select custom hex colors for from a range of values. + +## Structure + +The `Color Picker` takes in several props + +<CustomArgsTable of={ColorPicker} /> + +## Default: + +<Example title="Default"> + <ColorPicker defaultValue="#000000" /> +</Example> + +## ColorPicker Story + +<Canvas> + <Story + name="Default" + args={{ + defaultValue: "#21aef3", + onChange: (value) => { + console.debug(value); + }, + resetDefaultValue: "#000000", + className: "w-[200px]", + popoverAlign: "start", + }} + argTypes={{ + defaultValue: { + control: { + type: "text", + }, + }, + resetDefaultValue: { + control: { + type: "text", + }, + }, + popoverAlign: { + control: { + type: "inline-radio", + options: ["center", "start", "end"], + }, + }, + }}> + {({ defaultValue, onChange, resetDefaultValue, className, popoverAlign }) => ( + <VariantsTable titles={["Default"]} columnMinWidth={150}> + <VariantRow> + <TooltipProvider> + <Tooltip content="color picker"> + <ColorPicker + defaultValue={defaultValue} + onChange={onChange} + resetDefaultValue={resetDefaultValue} + className={className} + popoverAlign={popoverAlign} + /> + </Tooltip> + </TooltipProvider> + </VariantRow> + </VariantsTable> + )} + </Story> +</Canvas>