index.js 7.7 KB

1
  1. var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../../lib/Module"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../../lib/Types"));var _index=_interopRequireDefault(require("../BaseContainer/index"));var _index2=_interopRequireDefault(require("../Image/index"));var _index3=_interopRequireDefault(require("../Text/index"));var _ViewSystem=require("../../lib/systems/ViewSystem");var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\src\\modules\\BlogPost\\index.js";var defaultText="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla eget sapien justo. Nunc justo nunc, tristique sollicitudin sodales et, rhoncus vel augue. Mauris vel elit turpis. Vivamus hendrerit faucibus tortor, eget molestie turpis mattis vel. Cras maximus nibh vitae euismod lobortis. Sed iaculis quis lectus non rhoncus. Quisque non purus vel risus venenatis convallis eu at turpis. Cras accumsan quam eu dolor dignissim accumsan. Vestibulum sed orci facilisis, lacinia nibh vitae, egestas massa. Integer sit amet dui velit. Suspendisse ut nibh massa. Fusce condimentum semper odio, et hendrerit nisi venenatis consequat. Nam sed nibh eros. Nulla facilisi.";var BlogPost=function(_Module){(0,_inherits2.default)(BlogPost,_Module);function BlogPost(props){var _this;(0,_classCallCheck2.default)(this,BlogPost);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(BlogPost).call(this,props));_this.isTemplate=true;_this.id=props.ModuleID;_this.nextNumber=_regenerator.default.mark(function _callee(){var i;return _regenerator.default.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:i=0;case 1:i++;_context.next=4;return i;case 4:if(true){_context.next=1;break;}case 5:case"end":return _context.stop();}}},_callee);})();_this.NodeFactory=NodeFactory.bind((0,_assertThisInitialized2.default)(_this));_this.configure();return _this;}(0,_createClass2.default)(BlogPost,[{key:"configure",value:function configure(){if(this.props.CoreSystem){var CurrentView=this.props.View;var node=CurrentView.getNode(this.props.NodeID);var children=CurrentView.getChildren(node);var BackIcon=this.NodeFactory({},'Icon',{name:"keyboard-backspace",color:'rgba(255, 255, 255, 1)'});var IconContainer=this.NodeFactory({justifyContent:'flex-end',height:48,width:58},'BaseContainer',{});var base1=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{});var base2=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{flex:1,paddingTop:24,paddingBottom:24});var Image1=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{alignItems:'flex-start'},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Image"));var wrapper=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{marginLeft:24,marginRight:24,flexDirection:"row",justifyContent:"space-between",alignItems:"flex-end"});var Title=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Text",{text:"This is the post Title",color:"rgba(112, 112, 112, 1)",fontSize:24,fontFamily:"roboto-regular"}));var BookMark=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Icon",{}));var subtitle=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{marginLeft:24,marginRight:24},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Text",{text:"This is the subtitle",color:"rgba(193,193,193,1)",fontSize:14,fontFamily:"roboto-medium"}));var MainText=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{marginLeft:24,marginRight:24},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Text",{text:defaultText,color:"rgba(112, 112, 112, 1)",fontSize:14,fontFamily:'roboto-regular'}));var wrapperProfile=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{marginLeft:24,marginRight:24,flexDirection:"row",paddingTop:24,paddingBottom:24});var ImageWrapper=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{flexDirection:"row",justifyContent:"flex-end"},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"BaseContainer",{width:34}));var ImageProfile=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Image",{source:require("../Image/assets/profile.png"),width:32,height:32}));var UserWrapper=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{marginLeft:4,flexDirection:"column",height:40,flexGrow:1});var user=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{height:20},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Text",{text:"Alexandra papadopoulou ",color:"rgba(112, 112, 112, 1)",fontSize:12,fontFamily:"roboto-regular"}));var userjob=new _ViewSystem.Node("SS"+this.nextNumber.next().value,{height:20},new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,"Text",{text:"MARKET ANALYST",color:"rgba(112, 112, 112, 1)",fontSize:10,fontFamily:"roboto-light",letterSpacing:1.5}));console.log("MATCHCHECK ",CurrentView.has(base1));if(!CurrentView.has(base1))CurrentView.addViewNode(base1,node);if(!CurrentView.has(base2.id))CurrentView.addViewNode(base2,node);if(!CurrentView.has(Image1.id))CurrentView.addViewNode(Image1,base1);if(!CurrentView.has(IconContainer.id))CurrentView.addViewNode(IconContainer,Image1);if(!CurrentView.has(BackIcon.id))CurrentView.addViewNode(BackIcon,IconContainer);if(!CurrentView.has(wrapper.id))CurrentView.addViewNode(wrapper,base2);if(!CurrentView.has(Title.id))CurrentView.addViewNode(Title,wrapper);if(!CurrentView.has(BookMark.id))CurrentView.addViewNode(BookMark,wrapper);if(!CurrentView.has(subtitle.id)){CurrentView.addViewNode(subtitle,base2);}if(!CurrentView.has(wrapperProfile.id)){CurrentView.addViewNode(wrapperProfile,base2);}if(!CurrentView.has(ImageWrapper))CurrentView.addViewNode(ImageWrapper,wrapperProfile);if(!CurrentView.has(ImageProfile))CurrentView.addViewNode(ImageProfile,ImageWrapper);if(!CurrentView.has(UserWrapper))CurrentView.addViewNode(UserWrapper,wrapperProfile);if(!CurrentView.has(user))CurrentView.addViewNode(user,UserWrapper);if(!CurrentView.has(userjob)){CurrentView.addViewNode(userjob,UserWrapper);this.props.CoreSystem.forceUpdate();};if(!CurrentView.has(MainText.id)){CurrentView.addViewNode(MainText,base2);this.props.CoreSystem.forceUpdate();}}}},{key:"display",value:function display(){return _react.default.createElement(_reactNative.View,{__source:{fileName:_jsxFileName,lineNumber:139}});}}]);return BlogPost;}(_Module2.default);exports.default=BlogPost;BlogPost.Inputs={};var NodeFactory=function NodeFactory(){var containerStyle=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var component=arguments.length>1?arguments[1]:undefined;var componentStyle=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return new _ViewSystem.Node("SS"+this.nextNumber.next().value,containerStyle,new _ViewSystem.ViewNode("S"+this.nextNumber.next().value,component,componentStyle));};