From 7e3757c2f64bfcd0857433d8eddc981ac178f094 Mon Sep 17 00:00:00 2001 From: sggerard Date: Mon, 6 Jan 2025 14:28:17 -0800 Subject: [PATCH] Add IRadioOption --- .../common/src/components/forms/RenderRadioButtons.tsx | 4 ++-- services/common/src/interfaces/common/option.interface.ts | 7 ++++++- .../core-web/src/components/common/RenderRadioButtons.tsx | 3 ++- .../src/components/common/RenderRadioButtons.tsx | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/services/common/src/components/forms/RenderRadioButtons.tsx b/services/common/src/components/forms/RenderRadioButtons.tsx index 3ae0487f17..d41bc58a1a 100644 --- a/services/common/src/components/forms/RenderRadioButtons.tsx +++ b/services/common/src/components/forms/RenderRadioButtons.tsx @@ -1,7 +1,7 @@ import React, { FC, useContext } from "react"; import { Form, Radio } from "antd"; import { BaseInputProps, BaseViewInput, getFormItemLabel } from "@mds/common/components/forms/BaseInput"; -import { IOption } from "@mds/common/interfaces"; +import { IRadioOption } from "@mds/common/interfaces"; import { FormContext } from "./FormWrapper"; /** @@ -10,7 +10,7 @@ import { FormContext } from "./FormWrapper"; interface RenderRadioButtonsProps extends BaseInputProps { label: string; - customOptions?: IOption[]; + customOptions?: IRadioOption[]; optionType?: "default" | "button"; isVertical?: boolean; } diff --git a/services/common/src/interfaces/common/option.interface.ts b/services/common/src/interfaces/common/option.interface.ts index e4d8025dcd..2b00968148 100644 --- a/services/common/src/interfaces/common/option.interface.ts +++ b/services/common/src/interfaces/common/option.interface.ts @@ -1,9 +1,14 @@ export interface IOption { label: string; - value: string | number ; + value: string | number; tooltip?: string; } +export interface IRadioOption { + label: string; + value: boolean | string; +} + export interface IGroupedDropdownList { groupName: string | number; opt: IOption[]; diff --git a/services/core-web/src/components/common/RenderRadioButtons.tsx b/services/core-web/src/components/common/RenderRadioButtons.tsx index 561dfbf5f0..e183aa26e6 100644 --- a/services/core-web/src/components/common/RenderRadioButtons.tsx +++ b/services/core-web/src/components/common/RenderRadioButtons.tsx @@ -1,5 +1,6 @@ import React, { FC } from "react"; import { Form, Radio, Space } from "antd"; +import { IRadioOption } from "@mds/common/interfaces"; /** * @class RenderRadioButtons - Ant Design `Radio` component used for boolean values in redux-form. @@ -17,7 +18,7 @@ interface RenderRadioButtonsProps { disabled: boolean; input: any; isVertical?: boolean; - customOptions: { label: string; value: any }[]; + customOptions: IRadioOption[]; } const RenderRadioButtons: FC = (props) => { diff --git a/services/minespace-web/src/components/common/RenderRadioButtons.tsx b/services/minespace-web/src/components/common/RenderRadioButtons.tsx index 83f0755d50..a6588ccc5f 100644 --- a/services/minespace-web/src/components/common/RenderRadioButtons.tsx +++ b/services/minespace-web/src/components/common/RenderRadioButtons.tsx @@ -1,5 +1,6 @@ import React, { FC } from "react"; import { Form, Radio } from "antd"; +import { IRadioOption } from "@mds/common/interfaces"; /** * @class RenderRadioButtons - Ant Design `Radio` component used for boolean values in redux-form. @@ -16,7 +17,7 @@ interface RenderRadioButtonsProps { meta: any; disabled: boolean; input: any; - customOptions: { label: string; value: any }[]; + customOptions: IRadioOption[]; } const RenderRadioButtons: FC = (props) => {