From 24ee761809d8ffd8726c88f5a741dd2b169e3433 Mon Sep 17 00:00:00 2001
From: Pan <panfree23@gmail.com>
Date: Mon, 11 Feb 2019 17:42:31 +0800
Subject: [PATCH] perf[Navbar]: refactor navbar style

---
 src/components/Breadcrumb/index.vue    |  2 +-
 src/components/ErrorLog/index.vue      | 29 ++-----------
 src/components/Hamburger/index.vue     |  7 ++--
 src/components/LangSelect/index.vue    |  9 ----
 src/components/Screenfull/index.vue    | 39 +-----------------
 src/components/SizeSelect/index.vue    |  9 ----
 src/components/ThemePicker/index.vue   |  5 ++-
 src/icons/svg/screenfull.svg           |  1 +
 src/views/layout/components/Navbar.vue | 57 +++++++++++++++-----------
 9 files changed, 48 insertions(+), 110 deletions(-)
 create mode 100644 src/icons/svg/screenfull.svg

diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue
index 5bc7a1b8..5f4d054f 100644
--- a/src/components/Breadcrumb/index.vue
+++ b/src/components/Breadcrumb/index.vue
@@ -63,7 +63,7 @@ export default {
     display: inline-block;
     font-size: 14px;
     line-height: 50px;
-    margin-left: 10px;
+    margin-left: 8px;
     .no-redirect {
       color: #97a8be;
       cursor: text;
diff --git a/src/components/ErrorLog/index.vue b/src/components/ErrorLog/index.vue
index 1fd883d0..c46cf110 100644
--- a/src/components/ErrorLog/index.vue
+++ b/src/components/ErrorLog/index.vue
@@ -1,21 +1,8 @@
 <template>
   <div v-if="errorLogs.length>0">
-    <el-badge :is-dot="true" style="line-height: 30px;" @click.native="dialogTableVisible=true">
-      <el-button size="small" type="danger" class="bug-btn">
-        <svg
-          t="1492682037685"
-          class="bug-svg"
-          viewBox="0 0 1024 1024"
-          version="1.1"
-          xmlns="http://www.w3.org/2000/svg"
-          p-id="1863"
-          xmlns:xlink="http://www.w3.org/1999/xlink"
-          width="128"
-          height="128">
-          <path
-            d="M969.142857 548.571429q0 14.848-10.861714 25.709714t-25.709714 10.861714l-128 0q0 97.718857-38.290286 165.705143l118.857143 119.442286q10.861714 10.861714 10.861714 25.709714t-10.861714 25.709714q-10.276571 10.861714-25.709714 10.861714t-25.709714-10.861714l-113.152-112.566857q-2.852571 2.852571-8.557714 7.424t-23.990857 16.274286-37.156571 20.845714-46.848 16.566857-55.442286 7.424l0-512-73.142857 0 0 512q-29.147429 0-58.002286-7.716571t-49.700571-18.870857-37.705143-22.272-24.868571-18.578286l-8.557714-8.009143-104.557714 118.272q-11.446857 11.995429-27.428571 11.995429-13.714286 0-24.576-9.142857-10.861714-10.276571-11.702857-25.417143t8.850286-26.587429l115.419429-129.718857q-33.133714-65.133714-33.133714-156.562286l-128 0q-14.848 0-25.709714-10.861714t-10.861714-25.709714 10.861714-25.709714 25.709714-10.861714l128 0 0-168.009143-98.852571-98.852571q-10.861714-10.861714-10.861714-25.709714t10.861714-25.709714 25.709714-10.861714 25.709714 10.861714l98.852571 98.852571 482.304 0 98.852571-98.852571q10.861714-10.861714 25.709714-10.861714t25.709714 10.861714 10.861714 25.709714-10.861714 25.709714l-98.852571 98.852571 0 168.009143 128 0q14.848 0 25.709714 10.861714t10.861714 25.709714zM694.857143 219.428571l-365.714286 0q0-75.995429 53.430857-129.426286t129.426286-53.430857 129.426286 53.430857 53.430857 129.426286z"
-            p-id="1864"/>
-        </svg>
+    <el-badge :is-dot="true" style="line-height: 25px;margin-top: -5px;" @click.native="dialogTableVisible=true">
+      <el-button style="padding: 8px 10px;" size="small" type="danger">
+        <svg-icon icon-class="bug" />
       </el-button>
     </el-badge>
 
@@ -67,16 +54,6 @@ export default {
 </script>
 
 <style scoped>
-.bug-btn.el-button--small {
-  padding: 9px 10px;
-}
-.bug-svg {
-  width: 1em;
-  height: 1em;
-  vertical-align: -0.15em;
-  fill: currentColor;
-  overflow: hidden;
-}
 .message-title {
   font-size: 16px;
   color: #333;
diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue
index 220d67ec..ca7457c1 100644
--- a/src/components/Hamburger/index.vue
+++ b/src/components/Hamburger/index.vue
@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div style="padding: 0 15px;" @click="toggleClick">
     <svg
       :class="{'is-active':isActive}"
       class="hamburger"
@@ -7,7 +7,7 @@
       xmlns="http://www.w3.org/2000/svg"
       width="64"
       height="64"
-      @click="toggleClick">
+    >
       <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z" />
     </svg>
   </div>
@@ -32,10 +32,11 @@ export default {
 <style scoped>
 .hamburger {
   display: inline-block;
-  cursor: pointer;
+  vertical-align: middle;
   width: 20px;
   height: 20px;
 }
+
 .hamburger.is-active {
   transform: rotate(180deg);
 }
diff --git a/src/components/LangSelect/index.vue b/src/components/LangSelect/index.vue
index ef5f2c44..fea7ba71 100644
--- a/src/components/LangSelect/index.vue
+++ b/src/components/LangSelect/index.vue
@@ -30,12 +30,3 @@ export default {
   }
 }
 </script>
-
-<style scoped>
-.international-icon {
-  font-size: 20px;
-  cursor: pointer;
-  vertical-align: -5px!important;
-}
-</style>
-
diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue
index 4cdcb568..5801ba4a 100644
--- a/src/components/Screenfull/index.vue
+++ b/src/components/Screenfull/index.vue
@@ -1,29 +1,6 @@
 <template>
   <div>
-    <svg
-      t="1508738709248"
-      class="screenfull-svg"
-      viewBox="0 0 1024 1024"
-      version="1.1"
-      xmlns="http://www.w3.org/2000/svg"
-      p-id="2069"
-      xmlns:xlink="http://www.w3.org/1999/xlink"
-      width="32"
-      height="32"
-      @click="click">
-      <path
-        d="M333.493443 428.647617 428.322206 333.832158 262.572184 168.045297 366.707916 64.444754 64.09683 64.444754 63.853283 366.570793 167.283957 262.460644Z"
-        p-id="2070"/>
-      <path
-        d="M854.845439 760.133334 688.61037 593.95864 593.805144 688.764889 759.554142 854.56096 655.44604 958.161503 958.055079 958.161503 958.274066 656.035464Z"
-        p-id="2071"/>
-      <path
-        d="M688.535669 428.550403 854.31025 262.801405 957.935352 366.921787 957.935352 64.34754 655.809313 64.081481 759.919463 167.535691 593.70793 333.731874Z"
-        p-id="2072"/>
-      <path
-        d="M333.590658 594.033341 167.8171 759.804852 64.218604 655.67219 64.218604 958.270996 366.342596 958.502263 262.234493 855.071589 428.421466 688.86108Z"
-        p-id="2073"/>
-    </svg>
+    <svg-icon class-name="screenfull-icon" icon-class="screenfull" />
   </div>
 </template>
 
@@ -32,20 +9,6 @@ import screenfull from 'screenfull'
 
 export default {
   name: 'Screenfull',
-  props: {
-    width: {
-      type: Number,
-      default: 22
-    },
-    height: {
-      type: Number,
-      default: 22
-    },
-    fill: {
-      type: String,
-      default: '#48576a'
-    }
-  },
   data() {
     return {
       isFullscreen: false
diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue
index a92a17c3..6d3cd43a 100644
--- a/src/components/SizeSelect/index.vue
+++ b/src/components/SizeSelect/index.vue
@@ -53,12 +53,3 @@ export default {
 
 }
 </script>
-
-<style scoped>
-.size-icon {
-  font-size: 20px;
-  cursor: pointer;
-  vertical-align: -4px!important;
-}
-</style>
-
diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue
index 5d1ff8bd..332b07e7 100644
--- a/src/components/ThemePicker/index.vue
+++ b/src/components/ThemePicker/index.vue
@@ -136,7 +136,10 @@ export default {
 
 <style>
 .theme-picker .el-color-picker__trigger {
-  vertical-align: middle;
+  margin-top: 12px;
+  height: 26px!important;
+  width: 26px!important;
+  padding: 2px;
 }
 
 .theme-picker-dropdown .el-color-dropdown__link-btn {
diff --git a/src/icons/svg/screenfull.svg b/src/icons/svg/screenfull.svg
new file mode 100644
index 00000000..0e86b6fa
--- /dev/null
+++ b/src/icons/svg/screenfull.svg
@@ -0,0 +1 @@
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M38.47 52L52 38.462l-23.648-23.67L43.209 0H.035L0 43.137l14.757-14.865L38.47 52zm74.773 47.726L89.526 76 76 89.536l23.648 23.672L84.795 128h43.174L128 84.863l-14.757 14.863zM89.538 52l23.668-23.648L128 43.207V.038L84.866 0 99.73 14.76 76 38.472 89.538 52zM38.46 76L14.792 99.651 0 84.794v43.173l43.137.033-14.865-14.757L52 89.53 38.46 76z"/></svg>
\ No newline at end of file
diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue
index 208186e3..018ef0f9 100644
--- a/src/views/layout/components/Navbar.vue
+++ b/src/views/layout/components/Navbar.vue
@@ -9,17 +9,17 @@
         <error-log class="errLog-container right-menu-item"/>
 
         <el-tooltip :content="$t('navbar.screenfull')" effect="dark" placement="bottom">
-          <screenfull class="screenfull right-menu-item"/>
+          <screenfull class="right-menu-item"/>
         </el-tooltip>
 
         <el-tooltip :content="$t('navbar.size')" effect="dark" placement="bottom">
-          <size-select class="international right-menu-item"/>
+          <size-select class="right-menu-item"/>
         </el-tooltip>
 
-        <lang-select class="international right-menu-item"/>
+        <lang-select class="right-menu-item"/>
 
         <el-tooltip :content="$t('navbar.theme')" effect="dark" placement="bottom">
-          <theme-picker class="theme-switch right-menu-item"/>
+          <theme-picker class="theme-picker right-menu-item"/>
         </el-tooltip>
       </template>
 
@@ -92,42 +92,52 @@ export default {
 <style rel="stylesheet/scss" lang="scss" scoped>
 .navbar {
   height: 50px;
-  line-height: 50px;
-  border-radius: 0px !important;
+  overflow: hidden;
+
   .hamburger-container {
-    line-height: 58px;
-    height: 50px;
+    line-height: 46px;
+    height: 100%;
     float: left;
-    padding: 0 10px;
+    cursor: pointer;
+    transition: background .3s;
+    &:hover {
+      background: rgba(0, 0, 0, .025)
+    }
   }
-  .breadcrumb-container{
+
+  .breadcrumb-container {
     float: left;
   }
+
   .errLog-container {
     display: inline-block;
     vertical-align: top;
   }
+
   .right-menu {
     float: right;
     height: 100%;
-    &:focus{
-     outline: none;
+    line-height: 50px;
+
+    &:focus {
+      outline: none;
     }
+
     .right-menu-item {
+      cursor: pointer;
       display: inline-block;
-      margin: 0 8px;
-    }
-    .screenfull {
-      height: 20px;
-    }
-    .international{
-      vertical-align: top;
-    }
-    .theme-switch {
-      vertical-align: 15px;
+      padding: 0 8px;
+      height: 100%;
+      font-size: 20px;
+      color: #5a5e66;
+      vertical-align: text-bottom;
+      transition: background .3s;
+      &:hover {
+        background: rgba(0, 0, 0, .025)
+      }
     }
+
     .avatar-container {
-      height: 50px;
       margin-right: 30px;
       .avatar-wrapper {
         margin-top: 5px;
@@ -138,6 +148,7 @@ export default {
           height: 40px;
           border-radius: 10px;
         }
+
         .el-icon-caret-bottom {
           cursor: pointer;
           position: absolute;
-- 
GitLab