Skip to content

Commit

Permalink
fix props
Browse files Browse the repository at this point in the history
  • Loading branch information
interim17 committed Oct 4, 2023
1 parent ddfc57b commit c91aa83
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
21 changes: 18 additions & 3 deletions src/components/CheckBoxTree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import classNames from "classnames";

import {
ChangeAgentsRenderingStateAction,
ColorChangesMap,
SetVisibleAction,
VisibilitySelectionMap,
} from "../../state/selection/types";
Expand Down Expand Up @@ -41,7 +42,11 @@ interface CheckBoxTreeProps {
payloadForSelectAll: VisibilitySelectionMap;
payloadForSelectNone: VisibilitySelectionMap;
isSharedCheckboxIndeterminate: boolean;
colorInfoForPicker: any; //TODO: type this
recentColors: string[]; //TODO: type this;
setColorInfoFromPicker: (
colorChanges?: ColorChangesMap,
recentColors?: string[]
) => void;
}
const CHECKBOX_SPAN_NO = 2;
const LABEL_SPAN_NO = 6;
Expand Down Expand Up @@ -216,7 +221,8 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
agentsHighlighted,
treeData,
agentsChecked,
colorInfoForPicker,
recentColors,
setColorInfoFromPicker,
} = this.props;
return treeData.length > 0 ? (
<div className={styles.container}>
Expand Down Expand Up @@ -258,7 +264,10 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
color={nodeData.color}
agentName={nodeData.title}
tags={this.getAgentTags(nodeData.title)}
colorInfoForPicker={colorInfoForPicker}
recentColors={recentColors}
setColorInfoFromPicker={
setColorInfoFromPicker
}
/>
<Text
style={{ maxWidth: 143 }}
Expand Down Expand Up @@ -332,6 +341,12 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
tags={[
value.value as string,
]}
recentColors={
recentColors
}
setColorInfoFromPicker={
setColorInfoFromPicker
}
/>
<label
className={
Expand Down
20 changes: 14 additions & 6 deletions src/components/ColorSwatch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import * as React from "react";
import { useState } from "react";

import ColorPicker from "../ColorPicker";

import styles from "./styles.css";
import ColorPickerPopover from "../ColorPickerPopover";
import { useState } from "react";
import { ColorChangesMap } from "../../state/selection/types";
interface ColorSwatchProps {
childrenHaveDifferentColors?: boolean;
color: string;
agentName: string;
tags: string[];
colorInfoForPicker: any; // TODO: type this
recentColors: string[];
setColorInfoFromPicker: (
colorChanges?: ColorChangesMap,
recentColors?: string[]
) => void;
}

const ColorSwatch = ({
childrenHaveDifferentColors,
color,
agentName,
tags,
colorInfoForPicker,
recentColors,
setColorInfoFromPicker,
}: ColorSwatchProps): JSX.Element => {
const [isColorPickerVisible, setColorPickerVisible] = useState(false);
const [initialColor, setInitialColor] = useState(color);
Expand Down Expand Up @@ -46,13 +53,14 @@ const ColorSwatch = ({
openModal();
}}
/>
<ColorPickerPopover
<ColorPicker
agentName={agentName}
tags={tags}
oldColor={initialColor}
isOpen={isColorPickerVisible}
closeModal={closeModal}
colorInfoForPicker={colorInfoForPicker}
recentColors={recentColors}
setColorInfoFromPicker={setColorInfoFromPicker}
/>
</>
);
Expand Down

0 comments on commit c91aa83

Please sign in to comment.