From 0b9e515e080b9f855d2eafc75c34bf6a14a4ad9e Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Thu, 16 May 2024 16:16:39 +0530 Subject: [PATCH] code review fixes --- .../wds/WDSTableWidget/component/Constants.ts | 4 +- .../component/cellComponents/ButtonCell.tsx | 11 ++++-- .../component/styles.module.css | 6 ++- .../WDSTableWidget/config/defaultsConfig.ts | 1 + .../propertyPaneConfig/PanelConfig/Color.ts | 38 +++++++++++++++++++ .../wds/WDSTableWidget/widget/index.tsx | 3 +- .../wds/WDSTableWidget/widget/utilities.ts | 7 +++- 7 files changed, 61 insertions(+), 9 deletions(-) diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts b/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts index 9a64bb2bd7b3..2cc91d20b432 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts +++ b/app/client/src/widgets/wds/WDSTableWidget/component/Constants.ts @@ -156,7 +156,7 @@ export interface CellWrappingProperties { export interface ButtonCellProperties { buttonVariant: ButtonCellProps["buttonVariant"]; - buttonColor?: string; + buttonColor?: ButtonCellProps["buttonColor"]; buttonLabel?: string; isCompact?: boolean; iconName?: IconName; @@ -351,7 +351,7 @@ export interface ColumnProperties allowSameOptionsInNewRow?: boolean; newRowSelectOptions?: DropdownOption[]; buttonLabel?: string; - buttonColor?: string; + buttonColor?: ButtonCellProps["buttonColor"]; onClick?: string; dropdownOptions?: string; onOptionChange?: string; diff --git a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/ButtonCell.tsx b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/ButtonCell.tsx index 6596385c2353..c473734326c2 100644 --- a/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/ButtonCell.tsx +++ b/app/client/src/widgets/wds/WDSTableWidget/component/cellComponents/ButtonCell.tsx @@ -6,14 +6,19 @@ import type { BaseCellComponentProps } from "../Constants"; export interface ButtonCellProps { buttonLabel?: string; - cellColor?: "default" | keyof typeof COLORS; + buttonColor?: keyof typeof COLORS; buttonVariant?: ButtonProps["variant"]; onClick?: (onComplete: () => void) => void; isDisabled?: boolean; } function ButtonCell(props: ButtonCellProps & BaseCellComponentProps) { - const { buttonLabel, buttonVariant, cellColor, isDisabled } = props; + const { + buttonColor = "accent", + buttonLabel, + buttonVariant, + isDisabled, + } = props; const [isLoading, setIsLoading] = useState(false); const onComplete = () => { @@ -30,7 +35,7 @@ function ButtonCell(props: ButtonCellProps & BaseCellComponentProps) { return (