Skip to content

Commit 5cc8f33

Browse files
committed
Iteration on menu fixes with flex, along with some design changes to make menu more neutral Fixes: Semantic-Org#1281, Semantic-Org#1475
1 parent 6b17f8f commit 5cc8f33

File tree

4 files changed

+131
-123
lines changed

4 files changed

+131
-123
lines changed

src/definitions/collections/menu.less

Lines changed: 91 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -51,96 +51,70 @@
5151
margin-bottom: 0rem;
5252
}
5353

54+
55+
/*--------------
56+
Sub-Menu
57+
---------------*/
58+
5459
.ui.menu .menu {
5560
margin: 0em;
5661
}
5762

58-
5963
.ui.menu:not(.vertical) > *,
6064
.ui.menu:not(.vertical) > .menu {
6165
display: flex;
6266
}
63-
.ui.menu:not(.vertical) .item {
64-
display: flex;
65-
align-items: center;
66-
}
6767

6868
/*--------------
69-
Colors
69+
Item
7070
---------------*/
7171

72-
/* Text Color */
73-
.ui.menu .item {
74-
color: @menuTextColor;
75-
}
76-
.ui.menu .item .item {
77-
color: @subMenuTextColor;
78-
}
79-
80-
/* Hover */
81-
.ui.menu .item .menu a.item:hover,
82-
.ui.menu .item .menu .link.item:hover {
83-
color: @darkTextColor;
72+
.ui.menu:not(.vertical) .item {
73+
display: flex;
74+
align-items: center;
8475
}
8576

86-
87-
/*--------------
88-
Items
89-
---------------*/
90-
9177
.ui.menu .item {
9278
position: relative;
93-
padding: @verticalPadding @horizontalPadding;
94-
border-top: @borderSize solid transparent;
95-
96-
background: @itemBackground;
9779
vertical-align: middle;
9880
line-height: 1;
9981
text-decoration: none;
10082
box-sizing: border-box;
101-
10283
-webkit-tap-highlight-color: transparent;
10384
user-select: none;
104-
transition: @transition;
105-
}
10685

86+
background: @itemBackground;
87+
padding: @itemVerticalPadding @itemHorizontalPadding;
88+
color: @textColor;
89+
transition: @itemTransition;
90+
}
10791

108-
/* Floated Content */
10992
.ui.menu > .item:first-child {
11093
border-radius: @borderRadius 0px 0px @borderRadius;
11194
}
112-
.ui.menu:not(.vertical) .item.left,
113-
.ui.menu:not(.vertical) .menu.left {
114-
display: flex;
115-
margin-right: auto;
116-
}
117-
.ui.menu:not(.vertical) .item.right,
118-
.ui.menu:not(.vertical) .menu.right {
119-
display: flex;
120-
margin-left: auto;
121-
}
122-
123-
124-
/*--------------
125-
Borders
126-
---------------*/
12795

96+
/* Border */
12897
.ui.menu .item:before {
12998
position: absolute;
13099
content: '';
131100
top: 0%;
132101
right: 0px;
133-
width: @dividerSize;
134102
height: 100%;
103+
104+
width: @dividerSize;
135105
background: @dividerBackground;
136106
}
137-
.ui.menu > .right.menu:first-child:before {
138-
display: none;
107+
108+
/*--------------
109+
Sub-Item
110+
---------------*/
111+
112+
.ui.menu .item .menu .item {
113+
color: @subMenuTextColor;
139114
}
140-
.ui.menu .menu.right .item:before,
141-
.ui.menu .item.right:before {
142-
right: auto;
143-
left: 0px;
115+
.ui.menu .item .menu a.item:hover,
116+
.ui.menu .item .menu .link.item:hover {
117+
color: @darkTextColor;
144118
}
145119

146120
/*--------------
@@ -176,7 +150,6 @@
176150
margin-left: @dropdownIconDistance;
177151
}
178152

179-
180153
/*--------------
181154
Button
182155
---------------*/
@@ -222,8 +195,8 @@
222195

223196
.ui.menu .header.item,
224197
.ui.vertical.menu .header.item {
225-
background: @headerBackground;
226198
margin: 0em;
199+
background: @headerBackground;
227200
text-transform: @headerTextTransform;
228201
font-weight: @headerWeight;
229202
}
@@ -235,46 +208,32 @@
235208

236209
/* Dropdown */
237210
.ui.menu .ui.dropdown.item.visible {
238-
background: @subtleTransparentBlack;
239211
border-bottom-right-radius: 0em;
240212
border-bottom-left-radius: 0em;
213+
background: @subtleTransparentBlack;
241214
}
242215
.ui.menu .ui.dropdown.active {
243216
box-shadow: none;
244217
}
245218

246219
/* Menu Position */
247220
.ui.menu .dropdown.item .menu {
248-
background: @dropdownBackground;
249221
left: 0px;
222+
background: @dropdownBackground;
250223
margin: @dropdownMenuOffset 0px 0px;
251224
min-width: ~"calc(100% - 1px)";
252225
box-shadow: @dropdownBoxShadow;
253226
}
254227
.ui.menu:not(.secondary) .pointing.dropdown.item .menu {
255-
margin-top: @dropdownPointingDistance;
256228
border-top-left-radius: 0em;
257229
border-top-right-radius: 0em;
230+
margin-top: @dropdownPointingDistance;
258231
}
259232
.ui.menu .simple.dropdown.item .menu {
260233
margin: 0px !important;
261234
}
262235

263236

264-
/* Secondary Menu Dropdown */
265-
.ui.secondary.menu > .menu > .active.dropdown.item {
266-
background-color: transparent;
267-
}
268-
.ui.secondary.menu .dropdown.item .menu {
269-
left: 0px;
270-
min-width: 100%;
271-
}
272-
273-
/* Even Width Menu Dropdown */
274-
.ui.item.menu .dropdown .menu .item {
275-
width: 100%;
276-
}
277-
278237
/*--------------
279238
Labels
280239
---------------*/
@@ -340,17 +299,17 @@
340299
background: @activeBackground;
341300
color: @selectedTextColor;
342301
font-weight: @activeFontWeight;
343-
box-shadow: 0em @activeBorderSize 0em inset;
302+
box-shadow: @activeBoxShadow;
344303
}
345304
.ui.menu .active.item > i.icon {
346305
opacity: @activeIconOpacity;
347306
}
348307

349-
/* Vertical */
308+
/* Vertical Active */
350309
.ui.vertical.menu .active.item {
351310
background: @activeBackground;
352311
border-radius: 0em;
353-
box-shadow: @activeBorderSize 0em 0em inset;
312+
box-shadow: @activeVerticalBoxShadow;
354313
}
355314
.ui.vertical.menu > .active.item:first-child {
356315
border-radius: 0em @borderRadius 0em 0em;
@@ -395,6 +354,34 @@
395354
Types
396355
*******************************/
397356

357+
/*--------------
358+
Floated Content
359+
---------------*/
360+
361+
/* Left Floated */
362+
.ui.menu:not(.vertical) .item.left,
363+
.ui.menu:not(.vertical) .menu.left {
364+
display: flex;
365+
margin-right: auto;
366+
}
367+
/* Right Floated */
368+
.ui.menu:not(.vertical) .item.right,
369+
.ui.menu:not(.vertical) .menu.right {
370+
display: flex;
371+
margin-left: auto;
372+
}
373+
374+
/* Floated Borders */
375+
.ui.menu > .right.menu:first-child:before {
376+
display: none;
377+
}
378+
.ui.menu .menu.right .item:before,
379+
.ui.menu .item.right:before {
380+
right: auto;
381+
left: 0px;
382+
}
383+
384+
398385
/*--------------
399386
Vertical
400387
---------------*/
@@ -410,7 +397,6 @@
410397
display: block;
411398
background: @verticalItemBackground;
412399
border-top: none;
413-
border-left: @borderSize solid transparent;
414400
border-right: none;
415401
}
416402
.ui.vertical.menu > .item:first-child {
@@ -480,7 +466,7 @@
480466

481467
/*--- Sub Menu ---*/
482468
.ui.vertical.menu .item:not(.dropdown) > .menu {
483-
margin: @subMenuMargin -@horizontalPadding 0em;
469+
margin: @subMenuMargin -@itemHorizontalPadding 0em;
484470
}
485471
.ui.vertical.menu .item:not(.dropdown) > .menu > .item {
486472
background: none;
@@ -547,7 +533,7 @@
547533

548534
/* Sub Menu Active */
549535
.ui.tiered.menu .sub.menu .active.item {
550-
padding-top: @verticalPadding;
536+
padding-top: @itemVerticalPadding;
551537
background: @tieredSubMenuActiveBackground;
552538
border-radius: 0;
553539
border-top: medium none;
@@ -675,7 +661,7 @@
675661
/* Active */
676662
.ui.pagination.menu .active.item {
677663
border-top: none;
678-
padding-top: @verticalPadding;
664+
padding-top: @itemVerticalPadding;
679665
background-color: @paginationActiveBackground;
680666
box-shadow: none;
681667
}
@@ -753,6 +739,15 @@
753739
background-color: @secondaryInvertedActiveBackground;
754740
}
755741

742+
/* Dropdown */
743+
.ui.secondary.menu > .menu > .active.dropdown.item {
744+
background-color: transparent;
745+
}
746+
.ui.secondary.menu .dropdown.item .menu {
747+
left: 0px;
748+
min-width: 100%;
749+
}
750+
756751

757752
/* Disable variations */
758753
.ui.secondary.item.menu > .item {
@@ -978,7 +973,7 @@
978973
}
979974
.ui.vertical.text.menu .item > i.icon {
980975
float: none;
981-
margin: 0em @verticalPadding 0em 0em;
976+
margin: 0em @itemVerticalPadding 0em 0em;
982977
}
983978
.ui.vertical.text.menu .header.item {
984979
margin: 0.8em 0em;
@@ -1058,6 +1053,7 @@
10581053
/* Item Icon Only */
10591054
.ui.menu .icon.item .icon {
10601055
margin: 0em;
1056+
width: auto;
10611057
}
10621058

10631059
.ui.vertical.icon.menu {
@@ -1178,7 +1174,13 @@
11781174
color: @invertedSubMenuColor;
11791175
}
11801176
.ui.inverted.menu .dropdown .menu .item {
1181-
color: @dropdownTextColor !important;
1177+
background: @dropdownItemBackground !important;
1178+
color: @dropdownItemColor !important;
1179+
transition: @dropdownItemTransition;
1180+
}
1181+
.ui.inverted.menu .dropdown .menu .item:hover {
1182+
background: @dropdownHoveredItemBackground !important;
1183+
color: @dropdownHoveredItemColor !important;
11821184
}
11831185
.ui.inverted.menu .item.disabled,
11841186
.ui.inverted.menu .item.disabled:hover {
@@ -1359,14 +1361,14 @@
13591361
.ui.horizontally.fitted.menu .item,
13601362
.ui.horizontally.fitted.menu .item .menu .item,
13611363
.ui.menu .horizontally.fitted.item {
1362-
padding-top: @verticalPadding;
1363-
padding-bottom: @verticalPadding;
1364+
padding-top: @itemVerticalPadding;
1365+
padding-bottom: @itemVerticalPadding;
13641366
}
13651367
.ui.vertically.fitted.menu .item,
13661368
.ui.vertically.fitted.menu .item .menu .item,
13671369
.ui.menu .vertically.fitted.item {
1368-
padding-left: @horizontalPadding;
1369-
padding-right: @horizontalPadding;
1370+
padding-left: @itemHorizontalPadding;
1371+
padding-right: @itemHorizontalPadding;
13701372
}
13711373

13721374
/*--------------
@@ -1453,6 +1455,10 @@
14531455
width: 8.333%;
14541456
}
14551457

1458+
/* Dropdown */
1459+
.ui.item.menu .dropdown .menu .item {
1460+
width: 100%;
1461+
}
14561462

14571463
/*--------------
14581464
Fixed

src/definitions/modules/transition.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ $.fn.transition = function() {
392392
$module.removeAttr('class');
393393
}
394394
if(module.cache.style) {
395-
console.log(module.cache.style);
396395
module.verbose('Restoring original style attribute', module.cache.style);
397396
$module.attr('style', module.cache.style);
398397
}

0 commit comments

Comments
 (0)