Yuki Takei 6 лет назад
Родитель
Сommit
f86da77e79
2 измененных файлов с 45 добавлено и 7 удалено
  1. 23 4
      src/client/js/components/Sidebar/SidebarNav.jsx
  2. 22 3
      src/client/styles/scss/_layout.scss

+ 23 - 4
src/client/js/components/Sidebar/SidebarNav.jsx

@@ -29,7 +29,7 @@ class SidebarNav extends React.Component {
     }
     }
   }
   }
 
 
-  generateSidebarItemObj(id, label, icon) {
+  generatePrimaryItemObj(id, label, icon) {
     const isSelected = this.props.currentContentsId === id;
     const isSelected = this.props.currentContentsId === id;
 
 
     return {
     return {
@@ -47,6 +47,22 @@ class SidebarNav extends React.Component {
     };
     };
   }
   }
 
 
+  generateSecondaryItemObj(id, label, icon, href) {
+    return {
+      id,
+      component: ({ className }) => (
+        <div className={`${className} grw-global-item-container`}>
+          <a href={href}>
+            <GlobalItem
+              icon={icon}
+              label={label}
+            />
+          </a>
+        </div>
+      ),
+    };
+  }
+
   generateIconFactory(classNames) {
   generateIconFactory(classNames) {
     return () => <i className={classNames}></i>;
     return () => <i className={classNames}></i>;
   }
   }
@@ -55,10 +71,13 @@ class SidebarNav extends React.Component {
     return (
     return (
       <GlobalNav
       <GlobalNav
         primaryItems={[
         primaryItems={[
-          this.generateSidebarItemObj('custom', 'Custom Sidebar', this.generateIconFactory('fa fa-2x fa-code')),
-          this.generateSidebarItemObj('history', 'History', this.generateIconFactory('icon-clock fa-2x')),
+          this.generatePrimaryItemObj('custom', 'Custom Sidebar', this.generateIconFactory('fa fa-code')),
+          this.generatePrimaryItemObj('history', 'History', this.generateIconFactory('icon-clock')),
+        ]}
+        secondaryItems={[
+          this.generateSecondaryItemObj('admin', 'Admin', this.generateIconFactory('icon-settings'), '/admin'),
+          this.generateSecondaryItemObj('help', 'Help', this.generateIconFactory('icon-question'), 'https://docs.growi.org'),
         ]}
         ]}
-        secondaryItems={[]}
       />
       />
     );
     );
   }
   }

+ 22 - 3
src/client/styles/scss/_layout.scss

@@ -68,9 +68,28 @@
     }
     }
   }
   }
 
 
-  .grw-global-item-container.active {
-    button {
-      @extend %fukidashi-for-active;
+  .grw-global-item-container {
+    i {
+      font-size: 1.5em;
+    }
+
+    // icon opacity
+    &:not(.active) {
+      i {
+        opacity: 0.4;
+      }
+      &:hover,
+      &:focus {
+        i {
+          opacity: 0.7;
+        }
+      }
+    }
+
+    &.active {
+      button {
+        @extend %fukidashi-for-active;
+      }
     }
     }
   }
   }
 }
 }