3
0

index.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import React from 'react';
  2. import Module from '../../lib/Module';
  3. import { View , StyleSheet , Text} from 'react-native';
  4. import Types from '../../lib/Types';
  5. import BaseContainer from '../BaseContainer/index';
  6. import ImageComp from '../Image/index';
  7. import TextComp from '../Text/index';
  8. import { ViewNode, Node } from '../../lib/systems/ViewSystem';
  9. export default class BlogFeed extends Module{
  10. constructor(props){
  11. super(props)
  12. this.configure();
  13. }
  14. configure(){
  15. if(this.props.CoreSystem){
  16. let CurrentView = this.props.View; //this.props.CoreSystem.getCurrentView();
  17. let node = CurrentView.getNode(this.props.NodeID)
  18. let NavContainer = NodeFactory({flexDirection:"row",justifyContent:"space-between",alignItems:'center'},'BaseContainer',{height:64,width:375,backgroundColor:'rgba(0, 84, 230, 1)'});
  19. let TitleWrapper = NodeFactory({flexDirection:"row",justifyContent:'center',alignItems:'center'},'BaseContainer',{height:41,width:327});
  20. let Title = NodeFactory({width:327},"Text",{fontSize:34,fontFamily:'bold',width:327,text:"Blog Feed"})
  21. let PostCont1 = NodeFactory({flexDirection:'column',justifyContent:'center',alignItems:'center'},'BaseContainer',{height:236,width:327});
  22. let PostCont2 = NodeFactory({flexDirection:'column',justifyContent:'center',alignItems:'center'},'BaseContainer',{height:236,width:327});
  23. //NavContainer Inputs
  24. let navIcon = NodeFactory({},'Icon',{name:"reorder",color:'rgba(255, 255, 255, 1)'})
  25. let navTitle = NodeFactory({},'Text',{text:"XDi",color:'rgba(255, 255, 255, 1)',fontSize:25})
  26. let navProfile = NodeFactory({},'Icon',{name:"perm-identity",color:'rgba(255, 255, 255, 1)'})
  27. //let Image1 = new Node("SS"+ Math.random(), {},new ViewNode("S"+Math.random(), "Image"))
  28. //PostCont 1 Inputs
  29. let image1 = NodeFactory({},'Image',{height:142,width:327});
  30. let wrapper1 = NodeFactory({},'BaseContainer',{height:91,width:327});
  31. let title1 = NodeFactory({},'Text',{text:"This is a titile ",fontFamily:"roboto-black",fontSize:18,color:"rgba(112, 112, 112, 1)"})
  32. let subtitle1 = NodeFactory({},'Text',{text:"This is a subtitle",fontFamily:"roboto-black",fontSize:14,color:"rgba(193, 193, 193, 1)"})
  33. //Text for now will be converted to date Picker
  34. let date1 = NodeFactory({alignSelf:'flex-end'},'Text',{text:"OCTOBER 9, 2019",fontFamily:"roboto-black",fontSize:10,color:"rgba(112, 112, 112, 1)"})
  35. //Post Cont 2 Inputs
  36. let image2 = NodeFactory({},'Image',{height:142,width:327});
  37. let wrapper2 = NodeFactory({},'BaseContainer',{height:91,width:327});
  38. let title2 = NodeFactory({},'Text',{text:"Thi is a title ",fontFamily:"roboto-black",fontSize:18,color:"rgba(112, 112, 112, 1)"})
  39. let subtitle2 = NodeFactory({},'Text',{text:"This is a subtitle ",fontFamily:"roboto-black",fontSize:14,color:"rgba(193, 193, 193, 1)"})
  40. //Text for now will be converted to date Picker
  41. let date2 = NodeFactory({alignSelf:'flex-end'},'Text',{text:"OCTOBER 9, 2019",fontFamily:"roboto-black",fontSize:10,color:"rgba(112, 112, 112, 1)"})
  42. //adding Containers
  43. if(!CurrentView.has(NavContainer)) CurrentView.addViewNode(NavContainer,node)
  44. if(!CurrentView.has(TitleWrapper)) CurrentView.addViewNode(TitleWrapper,node)
  45. if(!CurrentView.has(Title)) CurrentView.addViewNode(Title,TitleWrapper)
  46. if(!CurrentView.has(PostCont1)) CurrentView.addViewNode(PostCont1,node)
  47. if(!CurrentView.has(PostCont2)) {
  48. CurrentView.addViewNode(PostCont2,node)
  49. }
  50. //adding Children To NavContainer
  51. if(!CurrentView.has(navIcon)) CurrentView.addViewNode(navIcon,NavContainer)
  52. if(!CurrentView.has(navTitle)) CurrentView.addViewNode(navTitle,NavContainer)
  53. if(!CurrentView.has(navProfile)) CurrentView.addViewNode(navProfile,NavContainer)
  54. // --------------------- This is the end of Top Nav -------------
  55. // Start of Blog posts PostCont1
  56. if(!CurrentView.has(image1)) CurrentView.addViewNode(image1,PostCont1)
  57. if(!CurrentView.has(wrapper1)) CurrentView.addViewNode(wrapper1,PostCont1)
  58. if(!CurrentView.has(title1)) CurrentView.addViewNode(title1,wrapper1)
  59. if(!CurrentView.has(subtitle1)) CurrentView.addViewNode(subtitle1,wrapper1)
  60. if(!CurrentView.has(date1)) CurrentView.addViewNode(date1,wrapper1)
  61. //post Cont 2
  62. if(!CurrentView.has(image2)) CurrentView.addViewNode(image2,PostCont2)
  63. if(!CurrentView.has(wrapper2)) CurrentView.addViewNode(wrapper2,PostCont2)
  64. if(!CurrentView.has(title2)) CurrentView.addViewNode(title2,wrapper2)
  65. if(!CurrentView.has(subtitle2)) CurrentView.addViewNode(subtitle2,wrapper2)
  66. if(!CurrentView.has(date2)){
  67. CurrentView.addViewNode(date2,PostCont2)
  68. this.props.CoreSystem.forceUpdate();
  69. }
  70. }
  71. }
  72. render(){
  73. return(
  74. <View>
  75. </View>
  76. )
  77. }
  78. }
  79. BlogFeed.Inputs = {
  80. }
  81. var NodeFactory = function(containerStyle = {}, component, componentStyle = {}){
  82. return new Node("SS"+ Math.random(), containerStyle,new ViewNode("S"+Math.random(), component, componentStyle));
  83. }