Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. class Tabs extends React.Component {
  2.  
  3. render() {
  4. console.log("Tabs.render()");
  5. return (
  6. <ul className="nav nav-tabs">
  7. {tabData.map(function(tab){
  8. return (
  9. <Tab data={tab} isActive={this.props.activeTab === tab} handleClick={this.props.changeTab.bind(this,tab)} />
  10. );
  11. }.bind(this))}
  12. </ul>
  13. );
  14. }
  15.  
  16. }
  17.  
  18. class Tab extends React.Component {
  19.  
  20. render() {
  21. console.log("Tab.render()");
  22. return (
  23. <li onClick={this.props.handleClick} className={this.props.isActive ? "active" : null}>
  24. <a href="#">{this.props.data.name}</a>
  25. </li>
  26. );
  27. }
  28.  
  29. }
  30.  
  31. class TabContent extends React.Component {
  32.  
  33. render() {
  34. console.log("TabContent.render()");
  35. return (
  36. <div>
  37. {this.props.activeTab.name === 'File Info' ?
  38. <section className="panel panel-success">
  39. <FileInformationBox file={ this.props.file } response={ null } annotations={ this.props.annotations } />
  40. </section>
  41. :null}
  42. {this.props.activeTab.name === 'Filter Data' ?
  43. <section className="panel panel-warning">
  44. <FilterBox file={ file } />
  45. </section>
  46. :null}
  47. </div>
  48. );
  49. }
  50. }
  51.  
  52. class FileInformationTabs extends React.Component {
  53.  
  54. constructor(props) {
  55. super(props);
  56. this.state = {
  57. response: props.response,
  58. file: props.file,
  59. annotations: props.annotations
  60. };
  61. }
  62.  
  63. handleClick(tab) {
  64. this.setState(
  65. {
  66. activeTab: tab
  67. }
  68. );
  69. }
  70.  
  71. render() {
  72. console.log("FileInformationTabs.render()");
  73. return (
  74. <div>
  75. <Tabs activeTab={this.props.activeTab} changeTab={this.handleClick} />
  76. <TabContent
  77. file={ this.state.file }
  78. response={ this.state.response }
  79. annotations={ this.state.annotations }
  80. activeTab={ this.props.activeTab }
  81. />
  82. </div>
  83. );
  84. }
  85. }
  86.  
  87. class FilterBox extends React.Component {
  88.  
  89. render() {
  90. console.log("FilterBox.render()");
  91. return (
  92. <div>
  93. <h4>Filter Data</h4>
  94. </div>
  95. )
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement