vben
2020-11-11 2b95be8013e70e1b891601cecb6d9e03a56d1ac2
提交 | 用户 | age
2f6253 1 @import (reference) '../../../design/index.less';
2
66acb2 3 .active-style() {
V 4   color: @white;
5   background: linear-gradient(
6     118deg,
770283 7     rgba(@primary-color, 0.8),
66acb2 8     rgba(@primary-color, 1)
V 9   ) !important;
10 }
11
2f6253 12 .active-menu-style() {
13   .ant-menu-item-selected,
14   .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected {
66acb2 15     .active-style();
2f6253 16   }
17 }
18
19 .basic-menu {
66acb2 20   width: 100%;
V 21
96c10d 22   &-wrap {
V 23     height: 100%;
24   }
25
26   //  collapsed show title start
27   .show-title {
28     max-width: unset !important;
29     opacity: 1 !important;
30   }
31
5737e4 32   &.collapsed-show-title.ant-menu-inline-collapsed {
66acb2 33     .basic-menu-item__level1 {
V 34       padding: 2px 0;
35     }
36
96c10d 37     & > li[role='menuitem']:not(.ant-menu-submenu),
5737e4 38     & > li > .ant-menu-submenu-title {
V 39       display: flex;
96c10d 40       margin-top: 10px;
5737e4 41       font-size: 12px;
V 42       flex-direction: column;
770283 43       align-items: center;
4f6b65 44       line-height: 24px;
5737e4 45     }
e3cbc9 46
96c10d 47     & > li > .ant-menu-submenu-title {
V 48       line-height: 24px;
e3cbc9 49     }
5737e4 50   }
V 51
96c10d 52   // collapsed show title end
2b95be 53   .ant-menu-item,
bda3e5 54   .ant-menu-submenu-title {
V 55     > .basic-menu__name {
2b95be 56       width: 100%;
V 57
7692ff 58       .basic-menu__tag {
V 59         float: right;
60         margin-top: @app-menu-item-height / 2;
61         transform: translate(0%, -50%);
62       }
bda3e5 63     }
V 64   }
96c10d 65
bda3e5 66   .ant-menu-item {
V 67     transition: unset;
a3887f 68   }
V 69
70   &__tag {
71     display: inline-block;
72     padding: 2px 4px;
73     margin-right: 4px;
74     font-size: 12px;
75     line-height: 14px;
76     color: #fff;
77     border-radius: 2px;
78
79     &.dot {
80       width: 8px;
81       height: 8px;
82       padding: 0;
83       border-radius: 50%;
84     }
85
86     &.primary {
87       background: @primary-color;
88     }
89
90     &.error {
91       background: @error-color;
92     }
93
94     &.success {
95       background: @success-color;
96     }
97
98     &.warn {
99       background: @warning-color;
100     }
101   }
96c10d 102   // scrollbar -s tart
V 103   &__content {
31e271 104     /* 滚动槽 */
V 105     &::-webkit-scrollbar {
96c10d 106       width: 4px;
V 107       height: 4px;
31e271 108     }
V 109
110     &::-webkit-scrollbar-track {
111       background: rgba(0, 0, 0, 0);
112     }
113
114     &::-webkit-scrollbar-thumb {
96c10d 115       background: rgba(255, 255, 255, 0.2);
V 116       border-radius: 3px;
31e271 117       box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
V 118     }
119
120     ::-webkit-scrollbar-thumb:hover {
121       background: @border-color-dark;
122     }
123   }
96c10d 124   // scrollbar  end
31e271 125
96c10d 126   &__sidebar-hor {
V 127     // overflow: hidden;
770283 128
2f6253 129     &.ant-menu-horizontal {
130       display: flex;
131       border: 0;
132       align-items: center;
133
134       .basic-menu-item__level1 {
135         margin-right: 2px;
136       }
137
138       &.ant-menu-light {
96c10d 139         .basic-menu-item__level1 {
V 140           &.top-active-menu {
141             color: @primary-color;
142             border-bottom: 3px solid @primary-color;
143           }
144         }
145
2f6253 146         .ant-menu-item {
147           &.basic-menu-item__level1 {
770283 148             height: @header-height;
V 149             line-height: @header-height;
2f6253 150           }
151         }
152
153         .ant-menu-submenu:hover,
154         .ant-menu-item-open,
155         .ant-menu-submenu-open,
156         .ant-menu-item-selected,
770283 157         .ant-menu-submenu-selected,
2f6253 158         .ant-menu-item:hover,
159         .ant-menu-item-active,
160         .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
161         .ant-menu-submenu-active,
162         .ant-menu-submenu-title:hover {
349d19 163           color: @primary-color !important;
2f6253 164           border-bottom: 3px solid @primary-color;
165         }
166
167         .ant-menu-submenu {
168           &:hover {
169             border-bottom: 3px solid @primary-color;
170           }
171
172           &.ant-menu-selected,
173           &.ant-menu-submenu-selected {
174             border-bottom: 3px solid @primary-color;
175           }
176         }
177       }
178
179       &.ant-menu-dark {
180         background: transparent;
181
96c10d 182         .ant-menu-submenu:hover,
V 183         .ant-menu-item-open,
184         .ant-menu-submenu-open,
185         .ant-menu-item-selected,
186         .ant-menu-submenu-selected,
187         .ant-menu-item:hover,
188         .ant-menu-item-active,
189         .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
190         .ant-menu-submenu-active,
191         .ant-menu-submenu-title:hover {
192           color: #fff;
193           background: @top-menu-active-bg-color !important;
194         }
195
2f6253 196         .ant-menu-item:hover,
197         .ant-menu-item-active,
198         .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
199         .ant-menu-submenu-active,
200         .ant-menu-submenu-title:hover {
201           background: @top-menu-active-bg-color;
202         }
203
204         .basic-menu-item__level1 {
96c10d 205           background: transparent;
V 206
207           &.top-active-menu {
208             color: @white;
209             background: @top-menu-active-bg-color;
210             border-radius: 2px 2px 0 0;
211           }
212
2f6253 213           &.ant-menu-item-selected,
214           &.ant-menu-submenu-selected {
96c10d 215             background: @top-menu-active-bg-color !important;
2f6253 216           }
217         }
218
96c10d 219         .ant-menu-item,
2f6253 220         .ant-menu-submenu {
221           &.basic-menu-item__level1,
222           .ant-menu-submenu-title {
223             height: @header-height;
224             line-height: @header-height;
225           }
226         }
227       }
228     }
229   }
230
4f6b65 231   &:not(.basic-menu__sidebar-hor).ant-menu-inline-collapsed {
V 232     .basic-menu-item__level1 {
233       > div {
234         align-items: center;
235       }
236     }
237   }
238
96c10d 239   &.ant-menu-dark:not(.basic-menu__sidebar-hor):not(.basic-menu__second) {
V 240     // Reset menu item row height
4f6b65 241     .ant-menu-item:not(.basic-menu-item__level1),
96c10d 242     .ant-menu-sub.ant-menu-inline > .ant-menu-item,
V 243     .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title {
244       height: @app-menu-item-height;
245       margin: 0;
246       line-height: @app-menu-item-height;
247     }
2f6253 248   }
249
250   // 层级样式
96c10d 251   &.ant-menu-dark:not(.basic-menu__sidebar-hor) {
V 252     overflow-x: hidden;
7692ff 253     background: @sider-dark-bg-color;
96c10d 254     .active-menu-style();
2f6253 255
256     .ant-menu-item.ant-menu-item-selected.basic-menu-menu-item__level1,
257     .ant-menu-submenu-selected.basic-menu-menu-item__level1 {
258       color: @white;
259     }
260
261     .basic-menu-item__level1 {
7692ff 262       background-color: @sider-dark-bg-color;
66acb2 263
31e271 264       > .ant-menu-sub > li {
7692ff 265         background-color: @sider-dark-lighten-1-bg-color;
31e271 266       }
2f6253 267     }
268
7c4dd2 269     .basic-menu-item__level2:not(.ant-menu-item-selected),
N 270     .ant-menu-sub {
7692ff 271       background-color: @sider-dark-lighten-1-bg-color;
2f6253 272     }
273
274     .basic-menu-item__level3:not(.ant-menu-item-selected) {
7692ff 275       background-color: @sider-dark-lighten-2-bg-color;
2f6253 276     }
277
278     .ant-menu-submenu-title {
70fba7 279       display: flex;
V 280       height: @app-menu-item-height;
96c10d 281       // margin: 0;
70fba7 282       align-items: center;
V 283     }
284
285     &.ant-menu-inline-collapsed {
5cff73 286       .ant-menu-submenu-selected,
V 287       .ant-menu-item-selected {
7692ff 288         background: @sider-dark-darken-bg-color !important;
5cff73 289       }
2f6253 290     }
291   }
292
96c10d 293   &.ant-menu-light:not(.basic-menu__sidebar-hor) {
770283 294     overflow-x: hidden;
V 295     border-right: none;
296
96c10d 297     // .ant-menu-item-selected {
V 298     //   background: fade(@primary-color, 18%);
299     // }
2f6253 300
301     .ant-menu-item.ant-menu-item-selected.basic-menu-menu-item__level1,
302     .ant-menu-submenu-selected.basic-menu-menu-item__level1 {
303       color: @primary-color;
304     }
305   }
306
307   // 关键字的颜色
308   &__keyword {
309     color: lighten(@primary-color, 20%);
310   }
311
312   // 激活的子菜单样式
313   .ant-menu-item.ant-menu-item-selected {
314     position: relative;
96c10d 315   }
V 316
317   &.basic-menu__second.ant-menu-inline-collapsed:not(.basic-menu__sidebar-hor) {
318     // Reset menu item row height
319     .ant-menu-item,
320     .ant-menu-sub.ant-menu-inline > .ant-menu-item,
321     .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title {
322       display: flex;
323       height: @app-menu-item-height * 1.4;
324       padding: 6px 0 !important;
325       margin: 0;
326       line-height: @app-menu-item-height;
327       align-items: center;
328     }
2f6253 329   }
330 }
331
332 // 触发器样式
333 .ant-layout-sider {
334   &-dark {
335     .ant-layout-sider-trigger {
336       color: darken(@white, 25%);
337       background: @trigger-dark-bg-color;
338
339       &:hover {
340         color: @white;
341         background: @trigger-dark-hover-bg-color;
342       }
343     }
344   }
345
346   &-light {
347     .ant-layout-sider-trigger {
348       color: @text-color-base;
770283 349       border-top: 1px solid @border-color-light;
2f6253 350     }
351   }
352 }
353
354 .ant-menu-dark {
355   &.ant-menu-submenu-popup {
356     > ul {
7692ff 357       background: @sider-dark-bg-color;
2f6253 358     }
359
360     .active-menu-style();
361   }
362 }
96c10d 363
V 364 .hide-title {
365   .ant-menu-inline-collapsed > .ant-menu-item,
366   .ant-menu-inline-collapsed > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item,
367   .ant-menu-inline-collapsed
368     > .ant-menu-item-group
369     > .ant-menu-item-group-list
370     > .ant-menu-submenu
371     > .ant-menu-submenu-title,
372   .ant-menu-inline-collapsed > .ant-menu-submenu > .ant-menu-submenu-title {
373     padding-right: 20px !important;
374     padding-left: 20px !important;
375   }
376
377   .ant-menu-inline-collapsed {
378     .basic-menu-item__level1 {
379       display: flex;
380       justify-content: center;
381     }
382   }
383 }