millayr commented on a change in pull request #883: Navbar refactor
URL: https://github.com/apache/couchdb-fauxton/pull/883#discussion_r109925106
 
 

 ##########
 File path: app/addons/fauxton/navigation/components/NavBar.js
 ##########
 @@ -0,0 +1,115 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
+import React, { Component } from 'react';
+
+import Footer from './Footer';
+import Burger from './Burger';
+import NavLink from './NavLink';
+import Brand from './Brand';
+import LogoutButton from './LogoutButton';
+import LoginButton from './LoginButton';
+
+import Actions from "../actions";
+
+import classNames from 'classnames';
+
+class NavBar extends Component {
+
+  createLinks (links) {
+    const { activeLink, isMinimized } = this.props;
+
+    return links.map((link, i) => {
+      return <NavLink
+        key={i}
+        link={link}
+        active={activeLink}
+        isMinimized={isMinimized} />;
+    });
+  }
+
+  toggleMenu () {
+    Actions.toggleNavbarMenu();
+  }
+
+  render () {
+    const {
+      isMinimized,
+      version,
+      isLoginSectionVisible,
+      isLoginVisibleInsteadOfLogout,
+      activeLink,
+      username,
+      isNavBarVisible
+    } = this.props;
+
+    if (!isNavBarVisible) {
+      return null;
+    }
+
+    const navLinks = this.createLinks(this.props.navLinks);
+    const bottomNavLinks = this.createLinks(this.props.bottomNavLinks);
+    const footerNavLinks = this.createLinks(this.props.footerNavLinks);
+
+    const navClasses = classNames(
+      'faux-navbar',
+      {'faux-navbar--wide':  !isMinimized},
+      {'faux-navbar--narrow': isMinimized}
+    );
+
+    const loginSection = isLoginVisibleInsteadOfLogout ?
+      <LoginButton active={activeLink} isMinimized={isMinimized} /> :
+      <LogoutButton username={username} isMinimized={isMinimized} />;
+
+    return (
+      <div className={navClasses}>
+        <nav>
+          <Burger isMinimized={isMinimized} toggleMenu={this.toggleMenu}/>
+          <div className="faux-navbar__flex">
 
 Review comment:
   no worries.  I renamed it to `faux-navbar__linkcontainer`
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to