feat: adding first version of Image component

This commit is contained in:
Mose Müller
2023-08-09 17:47:55 +02:00
parent 4d66b6b27c
commit 8d55f3b853
10 changed files with 87 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import { AsyncMethodComponent } from './AsyncMethodComponent';
import { StringComponent } from './StringComponent';
import { ListComponent } from './ListComponent';
import { DataServiceComponent, DataServiceJSON } from './DataServiceComponent';
import { ImageComponent } from './ImageComponent';
type AttributeType =
| 'str'
@ -19,7 +20,8 @@ type AttributeType =
| 'method'
| 'DataService'
| 'Enum'
| 'NumberSlider';
| 'NumberSlider'
| 'Image';
type ValueType = boolean | string | number | object;
export interface Attribute {
@ -149,6 +151,17 @@ export const GenericComponent = React.memo(
isInstantUpdate={isInstantUpdate}
/>
);
} else if (attribute.type === 'Image') {
return (
<ImageComponent
name={name}
parentPath={parentPath}
value={attribute.value['value']['value'] as string}
readOnly={attribute.readonly}
docString={attribute.doc}
// Add any other specific props for the ImageComponent here
/>
);
} else {
return <div key={name}>{name}</div>;
}