diff --git a/src/components/Configure/AddLegs.jsx b/src/components/Configure/AddLegs.jsx
index 5b2635a..c7a0e74 100644
--- a/src/components/Configure/AddLegs.jsx
+++ b/src/components/Configure/AddLegs.jsx
@@ -74,68 +74,38 @@ const AddLegs = () => {
updateLegs(updatedLegs);
};
- const renderTextField = (header) => {
- if (header === "action") {
- return (
-
-
-
-
- );
- } else if (header === "type") {
- return (
-
-
-
-
- );
- } else if (header === "strike") {
- return (
-
- );
- } else if (header === "premium") {
- return (
-
- );
- };
+ const renderTextField = (labelText, onChange, value, selectItems, inputProps) => {
+ return (
+
+ {selectItems &&
+ selectItems.map((item) => (
+
+ ))}
+
+ );
};
+
+ const ActionTextField = renderTextField("Action", handleActionChange, action, ["Buy", "Sell"]);
+ const TypeTextField = renderTextField("Type", handleTypeChange, type, ["CE", "PE"]);
+ const StrikeTextField = renderTextField("Strike", handleStrikeChange, strike, undefined, {
+ inputMode: 'numeric',
+ pattern: '[0-9]*',
+ });
+ const PremiumTextField = renderTextField("Premium", hanldePremiumChange, premium, undefined, {
+ inputMode: 'numeric',
+ pattern: '[0-9]*',
+ });
return (
{
{inputHeaders.map((header) => {
return (
- {renderTextField(header)}
+ {header === "action" && ActionTextField}
+ {header === "strike" && StrikeTextField}
+ {header === "premium" && PremiumTextField}
+ {header === "type" && TypeTextField}
)
})}