Skip to content

Commit 37f6ecd

Browse files
feat: add array type playground input
1 parent bbd496f commit 37f6ecd

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

website/src/pages/playground/_components/OptionSection.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { optionJsonSchemaMap } from "codemod-kit/browser";
22
import { useState, useEffect } from "react";
33
import validator from "@rjsf/validator-ajv8";
44
import { Select, Input, ConfigProvider, theme, Typography, Button } from "antd";
5+
import { DeleteOutlined } from "@ant-design/icons";
56
import Form from "@rjsf/antd";
67

78
import {
@@ -19,7 +20,7 @@ const CustomFieldTemplate = (props: FieldTemplateProps) => {
1920
const { label, required, errors, children } = props;
2021

2122
return (
22-
<div className="custom-field" style={{ marginBottom: "20px" }}>
23+
<div className="custom-field" style={{ marginBottom: "4px" }}>
2324
<div
2425
className="custom-field-label"
2526
style={{ fontWeight: "bold", marginBottom: "5px" }}
@@ -63,7 +64,6 @@ const CustomObjectFieldTemplate = (props: ObjectFieldTemplateProps) => {
6364

6465
// Skip rendering title for objects inside arrays
6566
const isNestedObject = uiSchema && uiSchema["ui:options"] && uiSchema["ui:options"].nested;
66-
6767
return (
6868
<div className="object-field-container">
6969
{!isNestedObject && title && (
@@ -90,8 +90,11 @@ const CustomArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
9090
<div className="array-field-container" style={{ marginBottom: "16px" }}>
9191
<div className="array-items">
9292
{items.map((element: ArrayFieldTemplateItemType) => (
93-
<div key={element.key} className="array-item-row" style={{ marginBottom: "8px", display: "flex", alignItems: "center" }}>
93+
<div key={element.key} className="array-item-row" style={{ marginBottom: "4px", display: "flex", alignItems: "center" }}>
9494
<div className="array-item-content" style={{ flex: 1 }}>
95+
<div style={{ fontSize: '12px', fontWeight: 'normal', color: '#666', marginBottom: '2px' }}>
96+
option{element.index + 1}
97+
</div>
9598
{element.children}
9699
</div>
97100
<Button
@@ -100,9 +103,8 @@ const CustomArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
100103
onClick={element.onDropIndexClick(element.index)}
101104
size="small"
102105
style={{ marginLeft: "8px", flexShrink: 0 }}
103-
>
104-
삭제
105-
</Button>
106+
icon={<DeleteOutlined />}
107+
/>
106108
</div>
107109
))}
108110
</div>
@@ -112,7 +114,7 @@ const CustomArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
112114
onClick={onAddClick}
113115
style={{ marginTop: "8px", width: "100%" }}
114116
>
115-
+ 항목 추가
117+
+ Add Option
116118
</Button>
117119
)}
118120
</div>
@@ -127,7 +129,6 @@ interface EnumOption {
127129
const CustomWidgets = {
128130
TextWidget: (props: WidgetProps) => {
129131
const { id, value, required, disabled, onChange, schema } = props;
130-
console.log(`TextWidget [${id}] 스키마:`, schema);
131132

132133
return (
133134
<div className="dark">
@@ -328,11 +329,18 @@ const OptionSection = () => {
328329
}
329330
.array-item-row .custom-field {
330331
margin-bottom: 0;
332+
padding: 2px 0;
333+
}
334+
.array-item-row .custom-field-label {
335+
display:none;
336+
}
337+
.array-item-row .ant-form-item-label > label {
338+
display: none;
331339
}
332340
.object-field-properties {
333341
display: flex;
334342
flex-direction: column;
335-
gap: 12px;
343+
gap: 4px;
336344
}
337345
`}
338346
</style>

0 commit comments

Comments
 (0)