Skip to content

Commit

Permalink
perf[Style]: optimize the sidebar style to make it better to set (#1568)
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJiaChen authored Jan 30, 2019
1 parent 727c1a4 commit b44000c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 17 deletions.
39 changes: 28 additions & 11 deletions src/styles/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,26 @@
width: 100% !important;
}

// menu hover
.submenu-title-noDropdown,
.el-submenu__title {
&:hover {
background-color: $menuHover !important;
}
}

.is-active>.el-submenu__title {
color: #f4f4f5 !important;
color: $subMenuActiveText !important;
}

& .nest-menu .el-submenu>.el-submenu__title,
& .el-submenu .el-menu-item {
min-width: $sideBarWidth !important;
background-color: $subMenuBg !important;

&:hover {
background-color: $subMenuHover !important;
}
}
}

Expand Down Expand Up @@ -108,16 +126,6 @@
}
}

.sidebar-container .nest-menu .el-submenu>.el-submenu__title,
.sidebar-container .el-submenu .el-menu-item {
min-width: $sideBarWidth !important;
background-color: $subMenuBg !important;

&:hover {
background-color: $menuHover !important;
}
}

.el-menu--collapse .el-menu .el-submenu {
min-width: $sideBarWidth !important;
}
Expand Down Expand Up @@ -150,10 +158,19 @@
}
}

// when menu collapsed
.el-menu--vertical {
&>.el-menu {
.svg-icon {
margin-right: 16px;
}
}

.nest-menu .el-submenu>.el-submenu__title,
.el-menu-item {
&:hover {
// You can use $subMenuHover
background-color: $menuHover !important;
}
}
}
19 changes: 13 additions & 6 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ $yellow:#FEC171;
$panGreen: #30B08F;

//sidebar
$menuBg:#304156;
$subMenuBg:#1f2d3d;
$menuHover:#001528;
$menuText:#bfcbd9;
$menuActiveText:#409EFF;
$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951

$menuBg:#304156;
$menuHover:#263445;

$subMenuBg:#1f2d3d;
$subMenuHover:#001528;

$sideBarWidth: 180px;

// the :export directive is the magic sauce for webpack
:export {
menuText: $menuText;
menuActiveText: $menuActiveText;
subMenuActiveText: $subMenuActiveText;
menuBg: $menuBg;
subMenuBg: $subMenuBg;
menuHover: $menuHover;
menuText:$menuText;
menuActiveText:$menuActiveText;
subMenuBg: $subMenuBg;
subMenuHover: $subMenuHover;
sideBarWidth: $sideBarWidth;
}

0 comments on commit b44000c

Please sign in to comment.