import React from "react" ; import { PreviewComponent , PreviewComponentProps , PreviewSize } from "../internal" ; import { ErrorBoundary } from "../../core/internal/ErrorBoundary" ; import { useStyles } from "./styles" ; import { Property } from "../../models" ; category export function ArrayOfStorageComponentsPreview ( { name , value , property , size } ) { if ( property . dataType !== "array" || ! property . of || property . of . dataType !== "string" ) throw Error ( "Picked wrong preview component ArrayOfStorageComponentsPreview" ) ; const childSize = size === "regular" ? "small" : "tiny" ; const classes = useStyles ( ) ; return < div className = { classes . arrayWrap } > { value && value . map ( ( v , index ) => < div className = { classes . arrayItem } key = { `preview_array_storage_${ name }_${ index }` } > < ErrorBoundary > < PreviewComponent name = { name } value = { v } property = { property . of as Property < string > } size = { childSize } / > < /ErrorBoundary> < /div>)} < /div>; }