Skip to content

Commit

Permalink
refactor: Comments Addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Pritish Budhiraja committed Dec 12, 2023
1 parent 154054d commit 9e68132
Showing 1 changed file with 7 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ let inputField = (
~getPlaceholder,
~checkRequiredFields,
~disabled,
~description="",
~toolTipPosition: ToolTip.toolTipPosition=ToolTip.Right,
(),
) =>
FormRenderer.makeFieldInfo(
~label,
~name,
~description,
~toolTipPosition,
~customInput=InputFields.textInput(~isDisabled=disabled, ()),
~placeholder=switch getPlaceholder {
| Some(fun) => fun(connector, field, label)
Expand All @@ -56,46 +60,6 @@ let inputField = (
(),
)

let inputFieldForConnectorLabel = (
~name,
~field,
~label,
~connector: ConnectorTypes.connectorName,
~getPlaceholder,
~checkRequiredFields,
~disabled,
) => {
FormRenderer.makeFieldInfo(
~label,
~isRequired=switch checkRequiredFields {
| Some(fun) => fun(connector, field)
| None => true
},
~name,
~description="This is an unique label you can generate and pass in order to identify this connector account on your Hyperswitch dashboard and reports. Eg: if your profile label is 'default', connector label can be 'stripe_default'",
~toolTipPosition=Right,
~customInput=(~input, ~placeholder as _) =>
InputFields.textInput(
~input={
...input,
value: input.value,
onChange: {
ev => {
input.onChange(ev)
}
},
},
~isDisabled=disabled,
~placeholder=switch getPlaceholder {
| Some(fun) => fun(connector, field, label)
| None => `Enter ${label->LogicUtils.snakeToTitle}`
},
(),
),
(),
)
}

module ErrorValidation = {
@react.component
let make = (~fieldName, ~validate) => {
Expand Down Expand Up @@ -205,14 +169,16 @@ module RenderConnectorLabel = {
<div key={label}>
<FormRenderer.FieldRenderer
labelClass="font-semibold !text-hyperswitch_black"
field={inputFieldForConnectorLabel(
field={inputField(
~name=formName,
~field,
~label,
~connector,
~checkRequiredFields,
~getPlaceholder,
~disabled,
~description="This is an unique label you can generate and pass in order to identify this connector account on your Hyperswitch dashboard and reports. Eg: if your profile label is 'default', connector label can be 'stripe_default'",
(),
)}
/>
<ErrorValidation
Expand Down

0 comments on commit 9e68132

Please sign in to comment.