1 import React from 'react'
2 import ListCard from './ListCard'
3 import ContainerCard from './ContainerCard'
4 import ChoiceCard from './ChoiceCard'
5 import LoadingCard from './LoadingCard'
7 const cardComponent = {
9 container: ContainerCard,
13 export default class extends React.Component {
17 const { model, path, properties, selected, openElement } = this.props;
18 const element = model.getElement(path);
19 const container = element.value;
20 console.debug(`PropertiesStack: ${properties.length}`);
21 const cards = properties.map((property, index) => {
22 const isSelected = selected ? selected === property.name : false;
23 const itemPath = path.slice();
24 itemPath.push(property.name);
25 const props = { model, 'path': itemPath, isSelected, 'openElement': openElement.bind(this, itemPath) };
27 <div key={property.name}>
28 {React.createElement(cardComponent[property.type], props)}
38 console.error("component render", e);