, name: string, schema
const SchemaPreview = ({schema, data, name, path}: Props) => {
const FormPreview = getSchemaFormatFromSchema(schema, SchemaPreview)
return (
-
-
)
};
SchemaPreview.String = function String({schema, path, data, name}: DataVisualizationType) {
const {dispatch} = useSchema();
return (
-
- {renderHeader({name, path, schema, icon: , onDelete: () => handleDelete(dispatch, path)})}
-
+
+ {renderHeader({
+ description: schema.description,
+ name,
+ path,
+ schema,
+ icon: ,
+ onDelete: () => handleDelete(dispatch, path)
+ })}
+
+ );
+};
+
+SchemaPreview.Enum = function Enum({schema, path, data, name}: DataVisualizationType) {
+ const {dispatch} = useSchema();
+ const enums = schema.enum
+ return (
+
+ {renderHeader({
+ description: <>{schema.description} Options: {enums.map(e => (
+ ))}>,
+ name,
+ path,
+ schema,
+ icon: ,
+ onDelete: () => handleDelete(dispatch, path)
+ })}
+
);
};
SchemaPreview.Number = function Number({schema, path, name}: DataVisualizationType) {
const {dispatch} = useSchema();
return (
-
- {renderHeader({name, path, schema, icon: , onDelete: () => handleDelete(dispatch, path)})}
-
+
+ {renderHeader({
+ description: schema.description,
+ name,
+ path,
+ schema,
+ icon: ,
+ onDelete: () => handleDelete(dispatch, path)
+ })}
+
);
};
SchemaPreview.Boolean = function BooleanVisualization({schema, path, name}: DataVisualizationType) {
const {dispatch} = useSchema();
return (
-
- {renderHeader({name, path, schema, icon: , onDelete: () => handleDelete(dispatch, path)})}
-
+
+ {renderHeader({
+ description: schema.description,
+ name,
+ path,
+ schema,
+ icon: ,
+ onDelete: () => handleDelete(dispatch, path)
+ })}
+
);
};
@@ -189,9 +228,12 @@ SchemaPreview.Object = function ObjectVisualization({schema, path, data, name}:
setOpen(!open);
};
+ const theme = useTheme();
+
return (
-
+
{renderHeader({
+ description: schema.description,
name,
path,
schema,
@@ -200,7 +242,7 @@ SchemaPreview.Object = function ObjectVisualization({schema, path, data, name}:
onCollapse: handleCollapse,
onDelete: () => handleDelete(dispatch, path)
})}
-
+
Properties
@@ -210,36 +252,46 @@ SchemaPreview.Object = function ObjectVisualization({schema, path, data, name}:
}}
- {properties?.length > 0 ? properties?.map((property) => (
- <>
-
- >
- )) : (
-
- Click on button to add properties
-
- )}
+
+ {properties?.length > 0 ? properties?.map((property) => (
+ <>
+
+ >
+ )) : (
+
+ Click on button to add properties
+
+ )}
+
-
-
+
+
);
};
SchemaPreview.Array = function ArrayVisualization({schema, path, data, name}: DataVisualizationType) {
const {dispatch} = useSchema();
+ const theme = useTheme();
return (
- <>
-
- {renderHeader({name,path, schema, icon: , onDelete: () => handleDelete(dispatch, path)})}
+
+ {renderHeader({
+ description: schema.description,
+ name,
+ path,
+ schema,
+ icon: ,
+ onDelete: () => handleDelete(dispatch, path)
+ })}
+
-
- >
+