naive-ui/styles/Menu.scss

275 lines
8.9 KiB
SCSS
Raw Normal View History

2019-11-27 17:01:21 +08:00
@import './mixins/mixins.scss';
2020-02-11 14:44:29 +08:00
2019-11-27 17:01:21 +08:00
@include themes-mixin() {
@include b(menu) {
2020-01-07 17:09:45 +08:00
color: $--menu-item-text-color;
@include once {
2020-01-13 23:06:58 +08:00
overflow: hidden;
2020-01-07 17:09:45 +08:00
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
width: 100%;
box-sizing: border-box;
font-size: 14px;
@include m(transition-disabled) {
2020-02-07 22:31:26 +08:00
@include b(menu-item-content) {
@include e(icon) {
@include b(icon) {
transition: none !important;
}
}
2020-02-07 22:31:26 +08:00
@include b(menu-item-content-header) {
transition: none !important;
2020-02-07 22:31:26 +08:00
@include e(extra) {
transition: none !important;
}
}
}
}
2020-01-07 17:09:45 +08:00
}
2020-02-07 22:31:26 +08:00
@include m(horizontal) {
2020-01-13 23:06:58 +08:00
@include b(menu-list) {
2020-02-07 22:52:51 +08:00
@include once {
display: flex;
}
@include b(menu-item) {
@include m(selected) {
@include once {
background-color: transparent !important;
}
@include b(menu-item-content) {
border-bottom: 2px solid $--menu-horizontal-border-color;
}
}
}
2020-02-07 22:31:26 +08:00
@include b(menu-item-content) {
2020-02-07 22:52:51 +08:00
@include once {
padding: 0 20px;
border-bottom: 2px solid transparent;
}
@include m(child-selected) {
2020-02-07 22:52:51 +08:00
border-bottom: 2px solid $--menu-horizontal-border-color;
2020-02-07 22:31:26 +08:00
}
@include not-m(disabled) {
&:hover {
2020-02-07 22:52:51 +08:00
border-bottom: 2px solid $--menu-horizontal-border-color;
2020-02-07 22:31:26 +08:00
}
@include m(hover) {
2020-02-07 22:52:51 +08:00
border-bottom: 2px solid $--menu-horizontal-border-color;
2020-01-15 01:33:01 +08:00
}
}
2020-01-13 23:06:58 +08:00
}
}
2020-02-07 22:31:26 +08:00
}
@include m(collapsed) {
@include b(menu-list) {
@include b(menu-item) {
@include m(selected) {
@include once {
background-color: transparent !important;
}
}
}
2020-02-07 22:31:26 +08:00
@include b(menu-item-content) {
2020-02-07 22:52:51 +08:00
@include once {
2020-02-07 22:52:51 +08:00
@include b(menu-item-content-header) {
opacity: 0;
}
@include e(arrow) {
opacity: 0;
}
}
2020-01-15 01:33:01 +08:00
@include e(icon) {
2020-02-07 22:31:26 +08:00
@include b(icon) {
2020-02-07 22:52:51 +08:00
fill: map-get($--menu-item-content-icon-color, 'collapsed');
stroke: map-get($--menu-item-content-icon-color, 'collapsed');
2020-02-07 22:31:26 +08:00
}
2020-01-15 01:33:01 +08:00
}
2020-01-13 23:06:58 +08:00
}
}
}
2019-12-31 18:22:45 +08:00
@include b(menu-list) {
2020-01-07 17:09:45 +08:00
@include once {
list-style: none;
margin: 0;
padding: 0;
2020-02-07 22:52:51 +08:00
@include b(menu-item) {
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
2020-02-07 22:52:51 +08:00
list-style: none;
2020-02-27 18:09:23 +08:00
height: 48px;
2020-02-07 22:52:51 +08:00
}
@include b(submenu) {
cursor: pointer;
position: relative;
2020-02-27 23:02:58 +08:00
@include b(menu-item-content) {
height: 48px;
}
@include b(submenu-content) {
padding: 0;
list-style: none;
@include fade-in-height-expand-transition($duration: .2s);
}
}
2020-01-07 17:09:45 +08:00
}
@include b(menu-item) {
@include m(selected) {
background-color: $--menu-item-background-color;
@include b(menu-item-content) {
@include e(icon) {
@include b(icon) {
fill: map-get($--menu-item-content-icon-color, 'selected');
stroke: map-get($--menu-item-content-icon-color, 'selected');
}
}
@include b(menu-item-content-header) {
color: map-get($--menu-item-content-text-color, 'selected');
@include e(extra) {
color: map-get($--menu-item-content-extra-text-color, 'selected');
}
}
}
}
}
2020-02-07 22:31:26 +08:00
@include b(menu-item-content) {
2020-02-07 22:52:51 +08:00
@include once {
box-sizing: border-box;
2020-02-22 14:11:34 +08:00
line-height: 1.75;
2020-02-27 18:09:23 +08:00
height: 100%;
2020-02-07 22:52:51 +08:00
display: flex;
2020-02-07 22:31:26 +08:00
align-items: center;
2020-02-07 22:52:51 +08:00
cursor: pointer;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, padding-left .3s $--n-ease-in-out-cubic-bezier, border-color .3s $--n-ease-in-out-cubic-bezier;
position: relative;
z-index: auto;
@include m(disabled) {
opacity: 0.45;
cursor: not-allowed;
}
@include m(collapsed) {
@include e(arrow) {
transition: transform 0.2s $--n-ease-in-out-cubic-bezier, opacity 0.2s $--n-ease-in-out-cubic-bezier, border-color 0.3s $--n-ease-in-out-cubic-bezier;
transform: rotate(225deg);
}
}
@include m(uncollapsable) {
cursor: default;
}
2020-02-07 22:52:51 +08:00
}
@include e(icon) {
@include once {
transition: font-size .3s $--n-ease-in-out-cubic-bezier, padding-right .3s $--n-ease-in-out-cubic-bezier;
box-sizing: content-box;
flex-shrink: 0;
padding-right: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
}
2020-02-07 22:31:26 +08:00
@include b(icon) {
2020-02-07 22:52:51 +08:00
fill: map-get($--menu-item-content-icon-color, 'default');
stroke: map-get($--menu-item-content-icon-color, 'default');
2020-02-07 22:31:26 +08:00
}
}
@include e(arrow) {
border-left: 2px solid $--menu-submenu-arrow-color;
border-top: 2px solid $--menu-submenu-arrow-color;
@include once {
content: '';
height: 6px;
width: 6px;
position: absolute;
right: 24px;
top: calc(50% - 3px);
transform: rotate(45deg) ;
transform-origin: 25% 25%;
opacity: 1;
transition: transform 0.2s $--n-ease-in-out-cubic-bezier, opacity 0.2s $--n-ease-in-out-cubic-bezier .1s, border-color 0.3s $--n-ease-in-out-cubic-bezier;
2020-01-07 17:09:45 +08:00
}
2020-02-07 22:31:26 +08:00
}
@include b(menu-item-content-header) {
2020-02-07 22:52:51 +08:00
@include once {
transition: color .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier;
opacity: 1;
flex-grow: 1;
flex-shrink: 1;
white-space: nowrap;
}
color: map-get($--menu-item-content-text-color, 'default');
2020-02-07 22:31:26 +08:00
@include e(extra) {
@include once {
white-space: nowrap;
margin-left: 6px;
display: inline-block;
transition: color 0.3s $--n-ease-in-out-cubic-bezier;
2020-03-05 22:31:20 +08:00
font-size: 13px;
2020-02-07 22:31:26 +08:00
}
2020-02-07 22:52:51 +08:00
color: map-get($--menu-item-content-extra-text-color, 'default');
2019-11-27 17:01:21 +08:00
}
}
2020-02-07 22:31:26 +08:00
@include not-m(disabled) {
& {
@include not-m(uncollapsable) {
&:hover {
@include e(icon) {
@include b(icon) {
fill: map-get($--menu-item-content-icon-color, 'hover');
stroke: map-get($--menu-item-content-icon-color, 'hover');
}
}
@include b(menu-item-content-header) {
color: map-get($--menu-item-content-text-color, 'hover');
@include e(extra) {
color: map-get($--menu-item-content-extra-text-color, 'selected');
}
}
2020-02-07 22:31:26 +08:00
}
@include m(hover) {
@include e(icon) {
@include b(icon) {
fill: map-get($--menu-item-content-icon-color, 'hover');
stroke: map-get($--menu-item-content-icon-color, 'hover');
}
}
@include b(menu-item-content-header) {
color: map-get($--menu-item-content-text-color, 'hover');
@include e(extra) {
color: map-get($--menu-item-content-extra-text-color, 'selected');
}
}
2020-02-07 00:05:44 +08:00
}
}
2019-11-27 17:01:21 +08:00
}
}
2020-02-07 22:31:26 +08:00
@include m(child-selected) {
@include b(menu-item-content-header) {
2020-02-07 22:52:51 +08:00
color: map-get($--menu-item-content-text-color, 'child-selected');
2020-02-07 22:31:26 +08:00
@include e(extra) {
2020-02-07 22:52:51 +08:00
color: map-get($--menu-item-content-extra-text-color, 'child-selected');
2020-02-07 00:05:44 +08:00
}
2020-01-15 01:33:01 +08:00
}
2020-02-07 22:31:26 +08:00
@include e(icon) {
@include b(icon) {
2020-02-07 22:52:51 +08:00
fill: map-get($--menu-item-content-icon-color, 'child-selected');
stroke: map-get($--menu-item-content-icon-color, 'child-selected');
2020-02-07 22:31:26 +08:00
}
}
}
}
2019-11-27 17:01:21 +08:00
}
@include b(menu-item-group) {
@include b(menu-item-group-title) {
2019-12-31 18:22:45 +08:00
color: $--menu-item-group-text-color;
2020-01-07 17:09:45 +08:00
@include once {
cursor: default;
2020-03-05 22:31:20 +08:00
font-size: 13px;
2020-01-07 17:09:45 +08:00
height: 40px;
display: flex;
align-items: center;
2020-02-07 22:31:26 +08:00
transition: padding-left .3s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier;
2020-01-07 17:09:45 +08:00
}
2019-11-27 17:01:21 +08:00
}
}
}
}