Skip to content

Commit 6000ff4

Browse files
chore: add ColorPicker in storybook (CALCOM-10760) (#10866)
Co-authored-by: gitstart-calcom <[email protected]>
1 parent cd7de98 commit 6000ff4

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { TooltipProvider } from "@radix-ui/react-tooltip";
2+
import { Canvas, Meta, Story } from "@storybook/addon-docs";
3+
4+
import {
5+
Example,
6+
Title,
7+
CustomArgsTable,
8+
VariantRow,
9+
VariantsTable,
10+
} from "@calcom/storybook/components";
11+
12+
import ColorPicker from "./colorpicker";
13+
14+
<Meta title="UI/Form/ColorPicker" component={ColorPicker} />
15+
16+
<Title title="ColorPicker" suffix="Brief" subtitle="Version 1.0 — Last Update: 16 Aug 2023" />
17+
18+
## Definitions
19+
20+
`Color Picker` is used to select custom hex colors for from a range of values.
21+
22+
## Structure
23+
24+
The `Color Picker` takes in several props
25+
26+
<CustomArgsTable of={ColorPicker} />
27+
28+
## Default:
29+
30+
<Example title="Default">
31+
<ColorPicker defaultValue="#000000" />
32+
</Example>
33+
34+
## ColorPicker Story
35+
36+
<Canvas>
37+
<Story
38+
name="Default"
39+
args={{
40+
defaultValue: "#21aef3",
41+
onChange: (value) => {
42+
console.debug(value);
43+
},
44+
resetDefaultValue: "#000000",
45+
className: "w-[200px]",
46+
popoverAlign: "start",
47+
}}
48+
argTypes={{
49+
defaultValue: {
50+
control: {
51+
type: "text",
52+
},
53+
},
54+
resetDefaultValue: {
55+
control: {
56+
type: "text",
57+
},
58+
},
59+
popoverAlign: {
60+
control: {
61+
type: "inline-radio",
62+
options: ["center", "start", "end"],
63+
},
64+
},
65+
}}>
66+
{({ defaultValue, onChange, resetDefaultValue, className, popoverAlign }) => (
67+
<VariantsTable titles={["Default"]} columnMinWidth={150}>
68+
<VariantRow>
69+
<TooltipProvider>
70+
<Tooltip content="color picker">
71+
<ColorPicker
72+
defaultValue={defaultValue}
73+
onChange={onChange}
74+
resetDefaultValue={resetDefaultValue}
75+
className={className}
76+
popoverAlign={popoverAlign}
77+
/>
78+
</Tooltip>
79+
</TooltipProvider>
80+
</VariantRow>
81+
</VariantsTable>
82+
)}
83+
</Story>
84+
</Canvas>

0 commit comments

Comments
 (0)