UNPKG

6.28 kBSCSSView Raw
1// nav mixins
2// --------------------------------------------------
3
4@mixin nav-size(
5 $direction,
6 $height,
7 $fontSize,
8 $padding,
9 $marginTB,
10 $marginLR,
11 $itemCorner
12) {
13 line-height: $height;
14 font-size: $fontSize;
15
16 #{$menu-prefix}-item#{$nav-prefix}-item {
17 margin-left: $marginLR;
18 margin-right: $marginLR;
19 padding: 0 $padding;
20 border-radius: $itemCorner;
21 }
22
23 @if $direction == 'ver' {
24 #{$menu-prefix}-item:not(:first-child),
25 #{$menu-prefix}-sub-menu-wrapper:not(:first-child) > #{$menu-prefix}-item {
26 margin-top: $marginTB;
27 }
28
29 #{$menu-prefix}-item:not(:last-child),
30 #{$menu-prefix}-sub-menu-wrapper:not(:last-child) > #{$menu-prefix}-item {
31 margin-bottom: $marginTB;
32 }
33 } @else {
34 #{$menu-prefix}-item,
35 #{$menu-prefix}-sub-menu-wrapper > #{$menu-prefix}-item {
36 margin-top: $marginTB;
37 margin-bottom: $marginTB;
38 }
39 }
40
41 #{$menu-prefix}-item-inner {
42 height: $height;
43 font-size: $fontSize;
44 }
45
46 #{$menu-prefix}-item#{$nav-prefix}-item#{$nav-prefix}-with-title {
47 line-height: 1;
48 padding: $s-3 $s-2;
49
50 #{$menu-prefix}-item-inner {
51 height: auto;
52 min-height: $height;
53 }
54 #{$nav-prefix}-text {
55 display: block;
56 line-height: 1;
57 margin-top: $s-2;
58 overflow: hidden;
59 text-overflow: ellipsis;
60 }
61 }
62}
63
64@mixin nav-border-fix($height, $border-width) {
65 $real-height: calc(#{$height} - #{$border-width} * 2);
66
67 border-width: $border-width;
68 &.#{$css-prefix}hoz {
69 line-height: $height;
70 line-height: $real-height;
71
72 #{$menu-prefix}-header,
73 #{$menu-prefix}-footer,
74 #{$menu-prefix}-item-inner {
75 line-height: $height;
76 height: $real-height;
77 }
78
79 &.#{$css-prefix}top #{$nav-prefix}-item:before {
80 top: 0;
81 top: calc(0px - #{$border-width});
82 }
83
84 &.#{$css-prefix}bottom #{$nav-prefix}-item:before {
85 bottom: 0;
86 bottom: calc(0px - #{$border-width});
87 }
88 }
89 &.#{$css-prefix}ver {
90 &.#{$css-prefix}left #{$nav-prefix}-item:before {
91 left: 0;
92 left: calc(0px - #{$border-width});
93 }
94
95 &.#{$css-prefix}right #{$nav-prefix}-item:before {
96 right: 0;
97 right: calc(0px - #{$border-width});
98 }
99 }
100}
101
102@mixin nav-statement(
103 $bgColor,
104 $borderColor,
105 $textColor,
106 $textWeight,
107 $shadow,
108 $hoverBgColor,
109 $hoverColor,
110 $hoverWeight,
111 $selectedBgColor,
112 $selectedColor,
113 $selectedWeight,
114 $activeColor,
115 $hoverLineColor,
116 $openedBgColor,
117 $openedColor,
118 $groupColor,
119 $groupWeight,
120 $childSelectedBgColor,
121 $childSelectedColor,
122 $childSelectedWeight,
123) {
124 background: $bgColor;
125 border-color: $borderColor;
126 color: $textColor;
127 font-weight: $textWeight;
128 box-shadow: $shadow;
129
130 #{$nav-prefix}-item#{$menu-prefix}-item {
131 background: $bgColor;
132 color: $textColor;
133
134 &.#{$css-prefix}focused,
135 &:hover {
136 background: $hoverBgColor;
137 color: $hoverColor;
138 font-weight: $hoverWeight;
139 }
140
141 &.#{$css-prefix}selected {
142 background: $selectedBgColor;
143 color: $selectedColor;
144 font-weight: $selectedWeight;
145 }
146
147 &.#{$css-prefix}opened {
148 background: $openedBgColor;
149 color: $openedColor;
150 }
151
152 &.#{$css-prefix}child-selected {
153 font-weight: $childSelectedWeight;
154 background: $childSelectedBgColor;
155 color: $childSelectedColor;
156 }
157
158 &.#{$css-prefix}opened.#{$css-prefix}nav-popup {
159 color: $openedColor;
160 }
161
162 &.#{$css-prefix}child-selected.#{$css-prefix}nav-popup {
163 color: $childSelectedColor;
164 }
165
166 &:before {
167 background: $activeColor;
168 }
169 &:hover:before {
170 background: $hoverLineColor;
171 }
172 }
173
174 #{$menu-prefix}-sub-menu #{$menu-prefix}-item.#{$css-prefix}opened {
175 background: $openedBgColor;
176 color: $openedColor;
177 }
178
179 #{$nav-prefix}-group-label {
180 color: $groupColor;
181 font-weight: $groupWeight;
182 }
183}
184
185@mixin sub-nav-statement(
186 $textColor,
187 $textWeight,
188 $bgColor,
189 $hoverBgColor,
190 $hoverColor,
191 $selectedBgColor,
192 $selectedColor,
193 $activeColor
194) {
195 #{$menu-prefix}-sub-menu #{$menu-prefix}-item {
196 background: $bgColor;
197 color: $textColor;
198 font-weight: $textWeight;
199
200 &.#{$css-prefix}focused,
201 &:hover {
202 background: $hoverBgColor;
203 color: $hoverColor;
204 }
205
206 &.#{$css-prefix}selected {
207 background: $selectedBgColor;
208 color: $selectedColor;
209 }
210 }
211}
212
213@mixin icon-only-size(
214 $border-width
215) {
216 #{$nav-prefix}-icon.#{$css-prefix}icon {
217 @include icon-size(
218 $size: $nav-icon-only-font-size,
219 $marginLeft: calc((#{$nav-icononly-width} - #{$nav-icon-only-font-size}) / 2 - #{$nav-ver-item-padding-lr}),
220 $marginRight: calc((#{$nav-icononly-width} - #{$nav-icon-only-font-size}) / 2 - #{$nav-ver-item-padding-lr})
221 );
222 @include icon-size(
223 $size: $nav-icon-only-font-size,
224 $marginLeft: calc((#{$nav-icononly-width} - #{$nav-icon-only-font-size}) / 2 - #{$nav-ver-item-padding-lr} - #{$border-width}),
225 $marginRight: calc((#{$nav-icononly-width} - #{$nav-icon-only-font-size}) / 2 - #{$nav-ver-item-padding-lr} - #{$border-width})
226 );
227 }
228}
229
230@mixin nav-disabled-statement($color) {
231 #{$nav-prefix}-item.#{$css-prefix}menu-item {
232 &.#{$css-prefix}disabled,
233 &.#{$css-prefix}disabled #{$menu-prefix}-item-text > a {
234 color: $color;
235 cursor: not-allowed;
236
237 #{$menu-prefix}-icon-arrow {
238 color: $color;
239 }
240
241 #{$menu-prefix}-icon-selected {
242 color: $color;
243 }
244 }
245 }
246}