Guest User

Untitled

a guest
Dec 12th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. export class Header extends React.Component<any, any> {
  2. private readonly searchServerUrl = "";
  3. private appButtonElement: HTMLElement;
  4.  
  5. constructor(props: any) {
  6. super(props);
  7.  
  8. this.state = { showAppMenu: false };
  9. }
  10.  
  11. render() {
  12. const { showAppMenu } = this.state;
  13. const { className, navItems, singleColumn, appItems } = this.props;
  14.  
  15. return (
  16. <header className={className}>
  17. <div className="app-icon">
  18. <button className="nav-button" onClick={() => this.toggleAppMenu()} ref={(menuButton: any) => this.appButtonElement = menuButton}><i className="ms-Icon ms-Icon--Waffle" aria-hidden="true"></i></button>
  19. </div>
  20.  
  21. ***When image is clicked, show the <AllSites/> component in the HomeComponent below.***
  22. <img src="/Styles/Images/logo/loop-logo-white.png" className="nav-logo" onClick={} />
  23.  
  24.  
  25. {showAppMenu ? <ApplicationMenu navItems={appItems} targetElement={this.appButtonElement} onDismiss={() => this.onDismiss()} /> : null}
  26. <div className="nav-container"><TopNavigation classNam
  27.  
  28. e={className} navItems={navItems} singleColumn={singleColumn} /></div>
  29. <div className="search-container">
  30. <SearchBox onSearch={(searchTerm: string) => this.executeSearch(searchTerm)} />
  31. </div>
  32. </header>
  33. );
  34. }
  35.  
  36. export class HomeComponent extends React.Component<any, any> {
  37. constructor(props: any) {
  38. super(props);
  39. this.state = { navItems: [], appItems: [], singleColumnLayout: false, showAllSites: false };
  40. }
  41.  
  42. componentDidMount() {
  43. this.checkWidth();
  44. window.addEventListener("resize", this.checkWidth.bind(this));
  45.  
  46. this.fetchNavigation()
  47. .then(nav => this.setState({ navItems: nav }));
  48.  
  49. this.fetchAppIcons()
  50. .then(icons => this.setState({ appItems: icons }));
  51. }
  52.  
  53.  
  54. componentWillUnmount(): void {
  55. window.addEventListener("resize", this.checkWidth.bind(this));
  56. }
  57.  
  58. render() {
  59. const { navItems, appItems, singleColumnLayout } = this.state;
  60.  
  61. return (
  62. <Fabric>
  63. <Header navItems={navItems} appItems={appItems} singleColumn={singleColumnLayout} />
  64. <div className="main-container">
  65. <AlertBar />
  66. <div className="main-content">
  67.  
  68.  
  69. <div className="ms-Grid">
  70.  
  71. <Hero singleColumn={singleColumnLayout} />
  72. <div className="ms-Grid-row">
  73. <div className="ms-Grid-col ms-sm12 ms-xl4 webpart-container">
  74. <UpcomingEvents />
  75. </div>
  76. <div className="ms-Grid-col ms-sm12 ms-xl4 webpart-container">
  77. <EmployeeNews />
  78. </div>
  79. <div className="ms-Grid-col ms-sm12 ms-xl4 webpart-container">
  80. <div className="ms-Grid-row">
  81. <div className="ms-Grid-col ms-sm12 webpart-container">
  82. <IndustryNews />
  83. </div>
  84. <div className="ms-Grid-col ms-sm12 webpart-container">
  85. <Quote />
  86. </div>
  87.  
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92.  
  93. <Footer navItems={navItems} />
  94. </div>
  95. </div>
  96. </Fabric>
  97. );
  98. }
Add Comment
Please, Sign In to add comment