diff --git a/striker-ui/components/CommonFenceInputGroup.tsx b/striker-ui/components/CommonFenceInputGroup.tsx index 582ceacf..b1fb333d 100644 --- a/striker-ui/components/CommonFenceInputGroup.tsx +++ b/striker-ui/components/CommonFenceInputGroup.tsx @@ -8,22 +8,38 @@ import SelectWithLabel from './SelectWithLabel'; import SwitchWithLabel from './SwitchWithLabel'; const CHECKED_STATES: Array = ['1', 'on']; +const ID_SEPARATOR = '-'; const MAP_TO_INPUT_BUILDER: MapToInputBuilder = { - boolean: ({ id, isChecked = false, label }) => ( + boolean: ({ id, isChecked = false, label, name = id }) => ( } + input={ + + } valueType="boolean" /> ), - select: ({ id, isRequired, label, selectOptions = [], value = '' }) => ( + select: ({ + id, + isRequired, + label, + name = id, + selectOptions = [], + value = '', + }) => ( @@ -31,16 +47,23 @@ const MAP_TO_INPUT_BUILDER: MapToInputBuilder = { required={isRequired} /> ), - string: ({ id, isRequired, label = '', value }) => ( + string: ({ id, isRequired, label = '', name = id, value }) => ( } + input={ + + } required={isRequired} /> ), }; -const combineIds = (...pieces: string[]) => pieces.join('-'); +const combineIds = (...pieces: string[]) => pieces.join(ID_SEPARATOR); const CommonFenceInputGroup: FC = ({ fenceId, @@ -156,4 +179,6 @@ const CommonFenceInputGroup: FC = ({ return <>{fenceParameterElements}; }; +export { ID_SEPARATOR }; + export default CommonFenceInputGroup; diff --git a/striker-ui/types/CommonFenceInputGroup.d.ts b/striker-ui/types/CommonFenceInputGroup.d.ts index b4709f90..fca8a606 100644 --- a/striker-ui/types/CommonFenceInputGroup.d.ts +++ b/striker-ui/types/CommonFenceInputGroup.d.ts @@ -3,6 +3,7 @@ type FenceParameterInputBuilder = (args: { isChecked?: boolean; isRequired?: boolean; label?: string; + name?: string; selectOptions?: string[]; value?: string; }) => ReactElement;