File indexing completed on 2025-02-23 05:30:51

0001 import React from 'react';
0002 import Support from './Support';
0003 class MobileSiteHeader extends React.Component {
0004   constructor(props){
0005         super(props);
0006         this.state = {
0007       status:"switch"
0008     };
0009     this.showMobileUserMenu = this.showMobileUserMenu.bind(this);
0010     this.showMobileSearchForm = this.showMobileSearchForm.bind(this);
0011     this.showMobileSwitchMenu = this.showMobileSwitchMenu.bind(this);
0012 
0013   }
0014 
0015   showMobileUserMenu(){
0016     this.setState({status:"user"});
0017   }
0018 
0019   showMobileSearchForm(){
0020     this.setState({status:"search"});
0021   }
0022 
0023   showMobileSwitchMenu(){
0024     this.setState({status:"switch"});
0025   }
0026 
0027   render(){
0028     const menuItemCssClass = {
0029       "borderColor":this.props.template['header-nav-tabs']['border-color'],
0030       "backgroundColor":this.props.template['header-nav-tabs']['background-color']
0031     }
0032 
0033     const closeMenuElementDisplay = (
0034       <a className="menu-item"  onClick={this.showMobileSwitchMenu}>
0035         <span className="glyphicon glyphicon-remove"></span>
0036       </a>
0037     );
0038 
0039     let PlingDisplay;
0040     if(this.props.section )
0041     {
0042         PlingDisplay =
0043             <div id="siter-header-pling">
0044             <Support section={this.props.section}
0045               headerStyle={this.props.template['header']['header-supporter-style']}
0046             />
0047             </div>
0048     }
0049 
0050     let mobileMenuDisplay;
0051     if (this.state.status === "switch"){
0052       mobileMenuDisplay = (
0053         <div id="switch-menu">
0054           {/*
0055           <a className="menu-item" onClick={this.showMobileSearchForm} id="user-menu-switch">
0056             <span className="glyphicon glyphicon-search"></span>
0057           </a>
0058         
0059           <a className="menu-item" onClick={this.showMobileUserMenu} id="search-menu-switch">
0060             <span className="glyphicon glyphicon-option-horizontal"></span>
0061           </a>
0062           */}
0063           { PlingDisplay }
0064         </div>
0065       );
0066     } else if (this.state.status === "user"){
0067       mobileMenuDisplay = (
0068         <div id="mobile-user-menu">
0069           <div className="menu-content-wrapper">
0070             <MobileUserContainer
0071               user={this.props.user}
0072               baseUrl={this.props.baseUrl}
0073               serverUrl={this.state.serverUrl}
0074               template={this.props.template}
0075               redirectString={this.props.redirectString}
0076             />
0077           </div>
0078           {closeMenuElementDisplay}
0079         </div>
0080       )
0081     } else if (this.state.status === "search"){
0082       mobileMenuDisplay = (
0083         <div id="mobile-search-menu">
0084           <div className="menu-content-wrapper">
0085             
0086           </div>
0087           {closeMenuElementDisplay}
0088         </div>
0089       )
0090     }
0091 
0092     let logoElementCssClass = this.props.store.name;
0093     if (this.state.status !== "switch"){
0094       logoElementCssClass += " mini-version";
0095     }
0096 
0097     return(
0098       <section id="mobile-site-header">
0099         <div id="mobile-site-header-logo" className={logoElementCssClass}>
0100           <a href={this.props.logoLink}>
0101             <img src={this.props.template['header-logo']['image-src']}/>
0102           </a>
0103         </div>
0104         <div id="mobile-site-header-menus-container">
0105           {mobileMenuDisplay}
0106         </div>
0107       </section>
0108     );
0109   }
0110 }
0111 
0112 export default MobileSiteHeader;