blob: 53975016695bc85c23d6a7bc7563e80bde6375b8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
// Name: Subnav
// Description: Component to create a sub navigation
//
// Component: `uk-subnav`
//
// Modifiers: `uk-subnav-divider`
// `uk-subnav-pill`
//
// States: `uk-active`
// `uk-first-column`
//
// ========================================================================
// Variables
// ========================================================================
$subnav-margin-horizontal: 20px !default;
$subnav-item-color: $global-muted-color !default;
$subnav-item-hover-color: $global-color !default;
$subnav-item-hover-text-decoration: none !default;
$subnav-item-active-color: $global-emphasis-color !default;
$subnav-divider-margin-horizontal: $subnav-margin-horizontal !default;
$subnav-divider-border-height: 1.5em !default;
$subnav-divider-border-width: $global-border-width !default;
$subnav-divider-border: $global-border !default;
$subnav-pill-item-padding-vertical: 5px !default;
$subnav-pill-item-padding-horizontal: 10px !default;
$subnav-pill-item-background: transparent !default;
$subnav-pill-item-color: $subnav-item-color !default;
$subnav-pill-item-hover-background: $global-muted-background !default;
$subnav-pill-item-hover-color: $global-color !default;
$subnav-pill-item-onclick-background: $subnav-pill-item-hover-background !default;
$subnav-pill-item-onclick-color: $subnav-pill-item-hover-color !default;
$subnav-pill-item-active-background: $global-primary-background !default;
$subnav-pill-item-active-color: $global-inverse-color !default;
$subnav-item-disabled-color: $global-muted-color !default;
/* ========================================================================
Component: Subnav
========================================================================== */
/*
* 1. Allow items to wrap into the next line
* 2. Gutter
* 3. Reset list
*/
.uk-subnav {
display: flex;
/* 1 */
flex-wrap: wrap;
/* 2 */
margin-left: (-$subnav-margin-horizontal);
/* 3 */
padding: 0;
list-style: none;
@if(mixin-exists(hook-subnav)) {@include hook-subnav();}
}
/*
* 1. Space is allocated solely based on content dimensions: 0 0 auto
* 2. Gutter
* 3. Create position context for dropdowns
*/
.uk-subnav > * {
/* 1 */
flex: none;
/* 2 */
padding-left: $subnav-margin-horizontal;
/* 3 */
position: relative;
}
/* Items
========================================================================== */
/*
* Items must target `a` elements to exclude other elements (e.g. dropdowns)
* Using `:first-child` instead of `a` to support `span` elements for text
* 1. Prevent gap if child element is `inline-block`, e.g. an icon
* 2. Style
*/
.uk-subnav > * > :first-child {
/* 1 */
display: block;
/* 2 */
color: $subnav-item-color;
@if(mixin-exists(hook-subnav-item)) {@include hook-subnav-item();}
}
/* Hover + Focus */
.uk-subnav > * > a:hover,
.uk-subnav > * > a:focus {
color: $subnav-item-hover-color;
text-decoration: $subnav-item-hover-text-decoration;
outline: none;
@if(mixin-exists(hook-subnav-item-hover)) {@include hook-subnav-item-hover();}
}
/* Active */
.uk-subnav > .uk-active > a {
color: $subnav-item-active-color;
@if(mixin-exists(hook-subnav-item-active)) {@include hook-subnav-item-active();}
}
/* Divider modifier
========================================================================== */
/*
* 1. Align items and divider vertically
*/
.uk-subnav-divider > * {
/* 1 */
display: flex;
align-items: center;
}
/*
* Divider
* `nth-child` makes it also work without JS if it's only one row
*/
.uk-subnav-divider > :nth-child(n+2):not(.uk-first-column)::before {
content: "";
height: $subnav-divider-border-height;
margin-left: ($subnav-divider-margin-horizontal - $subnav-margin-horizontal);
margin-right: $subnav-divider-margin-horizontal;
border-left: $subnav-divider-border-width solid $subnav-divider-border;
@if(mixin-exists(hook-subnav-divider)) {@include hook-subnav-divider();}
}
/* Pill modifier
========================================================================== */
.uk-subnav-pill > * > :first-child {
padding: $subnav-pill-item-padding-vertical $subnav-pill-item-padding-horizontal;
background: $subnav-pill-item-background;
color: $subnav-pill-item-color;
@if(mixin-exists(hook-subnav-pill-item)) {@include hook-subnav-pill-item();}
}
/* Hover + Focus */
.uk-subnav-pill > * > a:hover,
.uk-subnav-pill > * > a:focus {
background-color: $subnav-pill-item-hover-background;
color: $subnav-pill-item-hover-color;
@if(mixin-exists(hook-subnav-pill-item-hover)) {@include hook-subnav-pill-item-hover();}
}
/* OnClick */
.uk-subnav-pill > * > a:active {
background-color: $subnav-pill-item-onclick-background;
color: $subnav-pill-item-onclick-color;
@if(mixin-exists(hook-subnav-pill-item-onclick)) {@include hook-subnav-pill-item-onclick();}
}
/* Active */
.uk-subnav-pill > .uk-active > a {
background-color: $subnav-pill-item-active-background;
color: $subnav-pill-item-active-color;
@if(mixin-exists(hook-subnav-pill-item-active)) {@include hook-subnav-pill-item-active();}
}
/* Disabled
* The same for all style modifiers
========================================================================== */
.uk-subnav > .uk-disabled > a {
color: $subnav-item-disabled-color;
@if(mixin-exists(hook-subnav-item-disabled)) {@include hook-subnav-item-disabled();}
}
// Hooks
// ========================================================================
@if(mixin-exists(hook-subnav-misc)) {@include hook-subnav-misc();}
// @mixin hook-subnav(){}
// @mixin hook-subnav-item(){}
// @mixin hook-subnav-item-hover(){}
// @mixin hook-subnav-item-active(){}
// @mixin hook-subnav-divider(){}
// @mixin hook-subnav-pill-item(){}
// @mixin hook-subnav-pill-item-hover(){}
// @mixin hook-subnav-pill-item-onclick(){}
// @mixin hook-subnav-pill-item-active(){}
// @mixin hook-subnav-item-disabled(){}
// @mixin hook-subnav-misc(){}
// Inverse
// ========================================================================
$inverse-subnav-item-color: $inverse-global-muted-color !default;
$inverse-subnav-item-hover-color: $inverse-global-color !default;
$inverse-subnav-item-active-color: $inverse-global-emphasis-color !default;
$inverse-subnav-divider-border: $inverse-global-border !default;
$inverse-subnav-pill-item-background: transparent !default;
$inverse-subnav-pill-item-color: $inverse-global-muted-color !default;
$inverse-subnav-pill-item-hover-background: $inverse-global-muted-background !default;
$inverse-subnav-pill-item-hover-color: $inverse-global-color !default;
$inverse-subnav-pill-item-onclick-background: $inverse-subnav-pill-item-hover-background !default;
$inverse-subnav-pill-item-onclick-color: $inverse-subnav-pill-item-hover-color !default;
$inverse-subnav-pill-item-active-background: $inverse-global-primary-background !default;
$inverse-subnav-pill-item-active-color: $inverse-global-inverse-color !default;
$inverse-subnav-item-disabled-color: $inverse-global-muted-color !default;
// @mixin hook-inverse-subnav-item(){}
// @mixin hook-inverse-subnav-item-hover(){}
// @mixin hook-inverse-subnav-item-active(){}
// @mixin hook-inverse-subnav-divider(){}
// @mixin hook-inverse-subnav-pill-item(){}
// @mixin hook-inverse-subnav-pill-item-hover(){}
// @mixin hook-inverse-subnav-pill-item-onclick(){}
// @mixin hook-inverse-subnav-pill-item-active(){}
// @mixin hook-inverse-subnav-item-disabled(){}
|