mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: ui component for colorpicker
This commit is contained in:
parent
b1a5e4872b
commit
b0ccc6458c
27
packages/ui/src/color-picker/color-picker.tsx
Normal file
27
packages/ui/src/color-picker/color-picker.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { ColorResult, TwitterPicker } from "react-color";
|
||||||
|
|
||||||
|
type TColorPickerProps = {
|
||||||
|
colors?: string[];
|
||||||
|
onChange: (value: ColorResult) => void;
|
||||||
|
value?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const DEFAULT_COLORS = [
|
||||||
|
"#ff6900",
|
||||||
|
"#fcb900",
|
||||||
|
"#7bdcb5",
|
||||||
|
"#00d084",
|
||||||
|
"#8ed1fc",
|
||||||
|
"#0693e3",
|
||||||
|
"#abb8c3",
|
||||||
|
"#eb144c",
|
||||||
|
"#f78da7",
|
||||||
|
"#9900ef",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const ColorPicker: React.FC<TColorPickerProps> = (props) => {
|
||||||
|
const { colors, onChange, value } = props;
|
||||||
|
|
||||||
|
return <TwitterPicker colors={colors ?? DEFAULT_COLORS} color={value} onChange={onChange} />;
|
||||||
|
};
|
1
packages/ui/src/color-picker/index.ts
Normal file
1
packages/ui/src/color-picker/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./color-picker";
|
@ -2,6 +2,7 @@ export * from "./avatar";
|
|||||||
export * from "./breadcrumbs";
|
export * from "./breadcrumbs";
|
||||||
export * from "./badge";
|
export * from "./badge";
|
||||||
export * from "./button";
|
export * from "./button";
|
||||||
|
export * from "./color-picker";
|
||||||
export * from "./dropdowns";
|
export * from "./dropdowns";
|
||||||
export * from "./form-fields";
|
export * from "./form-fields";
|
||||||
export * from "./icons";
|
export * from "./icons";
|
||||||
|
Loading…
Reference in New Issue
Block a user