Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions viz-lib/src/visualizations/funnel/Editor/ColorsSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { useDebouncedCallback } from "use-debounce";
import { Section, ColorPicker } from "@/components/visualizations/editor";
import { EditorPropTypes } from "@/visualizations/prop-types";
import ColorPalette from "../../ColorPalette";

export default function ColorsSettings({ options, onOptionsChange }: any) {
const [onOptionsChangeDebounced] = useDebouncedCallback(onOptionsChange, 200);

return (
<React.Fragment>
{/* @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message */}
<Section>
<ColorPicker
layout="horizontal"
label="Color"
interactive
presetColors={ColorPalette}
placement="topRight"
color={options.color}
triggerProps={{ "data-test": "Funnel.Editor.Colors.color" }}
onChange={(color: any) => onOptionsChange({ color: color })}
// @ts-expect-error ts-migrate(2339) FIXME: Property 'Label' does not exist on type '({ classN... Remove this comment to see the full error message
addonAfter={<ColorPicker.Label color={options.color} presetColors={ColorPalette} />}
/>
</Section>
</React.Fragment>
);
}

ColorsSettings.propTypes = EditorPropTypes;
2 changes: 2 additions & 0 deletions viz-lib/src/visualizations/funnel/Editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import createTabbedEditor from "@/components/visualizations/editor/createTabbedE

import GeneralSettings from "./GeneralSettings";
import AppearanceSettings from "./AppearanceSettings";
import ColorsSettings from "./ColorsSettings";

export default createTabbedEditor([
{ key: "General", title: "General", component: GeneralSettings },
{ key: "Appearance", title: "Appearance", component: AppearanceSettings },
{ key: "Colors", title: "Colors", component: ColorsSettings },
]);
2 changes: 1 addition & 1 deletion viz-lib/src/visualizations/funnel/Renderer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function Renderer({ data, options }: any) {
align: "center",
render: (value: any, item: any) => (
// @ts-expect-error ts-migrate(2745) FIXME: This JSX tag's 'children' prop expects type 'never... Remove this comment to see the full error message
<FunnelBar align="center" color={ColorPalette.Cyan} value={item.pctMax}>
<FunnelBar align="center" color={options.color} value={item.pctMax}>
{formatValue(value)}
</FunnelBar>
),
Expand Down
Loading