Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: ColorPicker UI component #3743

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/ui/src/color-picker/color-picker.tsx
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions packages/ui/src/color-picker/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./color-picker";
1 change: 1 addition & 0 deletions packages/ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from "./avatar";
export * from "./breadcrumbs";
export * from "./badge";
export * from "./button";
export * from "./color-picker";
export * from "./dropdowns";
export * from "./form-fields";
export * from "./icons";
Expand Down