@@ -2,16 +2,12 @@ import FormatListNumberedIcon from "@mui/icons-material/FormatListNumbered";
2
2
import FormatColorTextIcon from "@mui/icons-material/FormatColorText" ;
3
3
import ArrowDropDownCircleIcon from "@mui/icons-material/ArrowDropDownCircle" ;
4
4
import ControlPointDuplicateIcon from "@mui/icons-material/ControlPointDuplicate" ;
5
- import AddIcon from "@mui/icons-material/Add" ;
6
- import RemoveIcon from "@mui/icons-material/Remove" ;
7
5
import {
8
6
FormControl ,
9
7
InputLabel ,
10
8
MenuItem ,
11
9
Select ,
12
10
TextField ,
13
- IconButton ,
14
- Checkbox ,
15
11
} from "@mui/material" ;
16
12
import React , { useState } from "react" ;
17
13
@@ -41,60 +37,6 @@ function SelectionCard({ index, sectionData, updateSectionData }) {
41
37
} ) ;
42
38
} ;
43
39
44
- const handleAddDropdownField = ( ) => {
45
- setDropdownFields ( [ ...dropdownFields , "" ] ) ;
46
- } ;
47
-
48
- const handleAddMultiSelectField = ( ) => {
49
- setMultiSelectFields ( [ ...multiSelectFields , "" ] ) ;
50
- } ;
51
-
52
- const handleDropdownFieldChange = ( index , value ) => {
53
- const updatedFields = [ ...dropdownFields ] ;
54
- updatedFields [ index ] = value ;
55
- setDropdownFields ( updatedFields ) ;
56
- updateSectionData ( index , {
57
- input,
58
- selectedOption,
59
- // dropdownData: updatedFields,
60
- // multiSelectData,
61
- } ) ;
62
- } ;
63
-
64
- const handleMultiSelectFieldChange = ( index , value ) => {
65
- const updatedFields = [ ...multiSelectFields ] ;
66
- updatedFields [ index ] = value ;
67
- setMultiSelectFields ( updatedFields ) ;
68
- updateSectionData ( index , {
69
- input,
70
- selectedOption,
71
- // dropdownData,
72
- // multiSelectData: updatedFields,
73
- } ) ;
74
- } ;
75
-
76
- // const handleRemoveDropdownField = (index) => {
77
- // const updatedFields = dropdownFields.filter((_, i) => i !== index);
78
- // setDropdownFields(updatedFields);
79
- // updateSectionData(index, {
80
- // input,
81
- // selectedOption,
82
- // dropdownData: updatedFields,
83
- // multiSelectData,
84
- // });
85
- // };
86
-
87
- // const handleRemoveMultiSelectField = (index) => {
88
- // const updatedFields = multiSelectFields.filter((_, i) => i !== index);
89
- // setMultiSelectFields(updatedFields);
90
- // updateSectionData(index, {
91
- // input,
92
- // selectedOption,
93
- // dropdownData,
94
- // multiSelectData: updatedFields,
95
- // });
96
- // };
97
-
98
40
const renderSelectedOption = ( ) => {
99
41
switch ( selectedOption ) {
100
42
case "number" :
@@ -160,75 +102,8 @@ function SelectionCard({ index, sectionData, updateSectionData }) {
160
102
< FormatColorTextIcon />
161
103
< span className = "px-2" > Text</ span >
162
104
</ MenuItem >
163
- { /* <MenuItem value="dropdown">
164
- <ArrowDropDownCircleIcon />
165
- <span className="px-2">Dropdown</span>
166
- </MenuItem>
167
- <MenuItem value="multiSelect">
168
- <ControlPointDuplicateIcon />
169
- <span className="px-2">Multiple Selects</span>
170
- </MenuItem> */ }
171
105
</ Select >
172
106
</ FormControl >
173
-
174
- { /* {selectedOption === "dropdown" && (
175
- <div className="mt-3">
176
- {dropdownFields.map((field, index) => (
177
- <div key={index} className="flex items-center gap-2 my-2">
178
- <TextField
179
- fullWidth
180
- label={`Dropdown Option ${index + 1}`}
181
- value={field}
182
- onChange={(e) =>
183
- handleDropdownFieldChange(index, e.target.value)
184
- }
185
- />
186
- <IconButton
187
- color="primary"
188
- onClick={() => handleRemoveDropdownField(index)}
189
- >
190
- <RemoveIcon className="bg-red-500 rounded-sm text-white hover:bg-red-600" />
191
- </IconButton>
192
- </div>
193
- ))}
194
- <IconButton color="primary" onClick={handleAddDropdownField}>
195
- <div className="flex items-center bg-slate-100 p-1 gap-1 rounded-sm justify-center hover:bg-slate-200">
196
- <p className="text-black text-base"> Add</p>
197
- <AddIcon className="bg-green-500 rounded-sm text-white" />
198
- </div>
199
- </IconButton>
200
- </div>
201
- )}
202
- {selectedOption === "multiSelect" && (
203
- <div className="mt-3 h-full m-5">
204
- {multiSelectFields.map((field, index) => (
205
- <div key={index} className="flex items-center gap-2 my-2">
206
- <Checkbox defaultChecked />
207
- <TextField
208
- fullWidth
209
- label={`Dropdown Option ${index + 1}`}
210
- value={field}
211
- variant="standard"
212
- onChange={(e) =>
213
- handleMultiSelectFieldChange(index, e.target.value)
214
- }
215
- />
216
- <IconButton
217
- color="primary"
218
- onClick={() => handleRemoveMultiSelectField(index)}
219
- >
220
- <RemoveIcon className="bg-red-500 rounded-sm text-white hover:bg-red-600" />
221
- </IconButton>
222
- </div>
223
- ))}
224
- <IconButton color="primary" onClick={handleAddMultiSelectField}>
225
- <div className="flex items-center bg-slate-100 p-1 gap-1 rounded-sm justify-center hover:bg-slate-200">
226
- <p className="text-black text-base"> Add</p>
227
- <AddIcon className="bg-green-500 rounded-sm text-white" />
228
- </div>
229
- </IconButton>
230
- </div>
231
- )} */ }
232
107
</ div >
233
108
</ div >
234
109
) ;
0 commit comments