JSFiddle - React, Tailwind, and code Playground

by Travis Harris

JavaScript

enyo.kind({
    name:'ComponentWrap',
    constructor:function(props){
        this.newComponents = props.components;
        props.components = [];
        this.inherited(arguments);
    },
    create:function(props){
        this.inherited(arguments);
        if(typeof this.$.wrapper !== 'undefined'
           && typeof this.newComponents === 'object'){
            for(i in this.newComponents){
                this.$.wrapper.createComponent(this.newComponents[i],{owner:this});
            }
        }
    }
});
enyo.kind({
  name:'myNewKind',
  kind:'ComponentWrap',
  components:[
    {
      style:'background-color:red;padding:10px;',
      components:[
        {
          style:'background-color:blue;padding:10px;',
          name:'wrapper'
        }
      ]
    }
  ]
});
var componentWrapSample = new myNewKind({
  components:[
        {
          style:'background-color:green;padding:10px;',
          name:'wrapper'
        }
      ]
    }
);
componentWrapSample.renderInto(document.body);