File tree Expand file tree Collapse file tree 1 file changed +27
-14
lines changed Expand file tree Collapse file tree 1 file changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,19 @@ const DynamicJsonForm = ({
132
132
const arrayValue = Array . isArray ( currentValue ) ? currentValue : [ ] ;
133
133
if ( ! propSchema . items ) return null ;
134
134
return (
135
- < div className = "space-y-2" >
136
- { arrayValue . map ( ( item , index ) => (
135
+ < div className = "space-y-4" >
136
+ { propSchema . description && (
137
+ < p className = "text-sm text-gray-600" > { propSchema . description } </ p >
138
+ ) }
139
+
140
+ { propSchema . items ?. description && (
141
+ < p className = "text-sm text-gray-500" >
142
+ Items: { propSchema . items . description }
143
+ </ p >
144
+ ) }
145
+
146
+ < div className = "space-y-2" >
147
+ { arrayValue . map ( ( item , index ) => (
137
148
< div key = { index } className = "flex items-center gap-2" >
138
149
{ renderFormFields (
139
150
propSchema . items as JsonSchemaType ,
@@ -154,18 +165,20 @@ const DynamicJsonForm = ({
154
165
</ Button >
155
166
</ div >
156
167
) ) }
157
- < Button
158
- variant = "outline"
159
- size = "sm"
160
- onClick = { ( ) => {
161
- handleFieldChange (
162
- path ,
163
- [ ...arrayValue , generateDefaultValue ( propSchema . items as JsonSchemaType ) ]
164
- ) ;
165
- } }
166
- >
167
- Add Item
168
- </ Button >
168
+ < Button
169
+ variant = "outline"
170
+ size = "sm"
171
+ onClick = { ( ) => {
172
+ handleFieldChange (
173
+ path ,
174
+ [ ...arrayValue , generateDefaultValue ( propSchema . items as JsonSchemaType ) ]
175
+ ) ;
176
+ } }
177
+ title = { propSchema . items ?. description ? `Add new ${ propSchema . items . description } ` : 'Add new item' }
178
+ >
179
+ Add Item
180
+ </ Button >
181
+ </ div >
169
182
</ div >
170
183
) ;
171
184
}
You can’t perform that action at this time.
0 commit comments