Project

General

Profile

1
// Name:            List
2
// Description:     Styles for lists
3
//
4
// Component:       `uk-list`
5
//
6
// Modifiers:       `uk-list-divider`
7
//                  `uk-list-striped`
8
//                  `uk-list-bullet`
9
//                  `uk-list-large`
10
//
11
// ========================================================================
12

    
13

    
14
// Variables
15
// ========================================================================
16

    
17
@list-margin-top:                               @global-small-margin;
18

    
19
@list-nested-padding-left:                      @global-gutter;
20

    
21
@list-divider-margin-top:                       @global-small-margin;
22
@list-divider-border-width:                     @global-border-width;
23
@list-divider-border:                           @global-border;
24

    
25
@list-striped-padding-vertical:                 @global-small-margin;
26
@list-striped-padding-horizontal:               @global-small-margin;
27
@list-striped-background:                       @global-muted-background;
28

    
29
@list-bullet-width:                             (@global-line-height * 1em);
30
@list-bullet-height:                            @list-bullet-width;
31
@list-bullet-margin-right:                      @global-small-margin;
32
@list-bullet-icon-color:                        @global-color;
33

    
34
@list-large-margin-top:                         @global-margin;
35
@list-large-divider-margin-top:                 @global-margin;
36
@list-large-striped-padding-vertical:           @global-margin;
37
@list-large-striped-padding-horizontal:         @global-small-margin;
38

    
39
@internal-list-bullet-image:                    "../../images/backgrounds/list-bullet.svg";
40

    
41

    
42
/* ========================================================================
43
   Component: List
44
 ========================================================================== */
45

    
46
.uk-list {
47
    padding: 0;
48
    list-style: none;
49
}
50

    
51
/*
52
 * Micro clearfix
53
 */
54

    
55
.uk-list > li::before,
56
.uk-list > li::after {
57
    content: "";
58
    display: table;
59
}
60

    
61
.uk-list > li::after { clear: both; }
62

    
63
/*
64
 * Remove margin from the last-child
65
 */
66

    
67
.uk-list > li > :last-child { margin-bottom: 0; }
68

    
69
/*
70
 * Nested lists
71
 */
72

    
73
.uk-list ul {
74
    margin: 0;
75
    padding-left: @list-nested-padding-left;
76
    list-style: none;
77
}
78

    
79
/*
80
 * Style
81
 */
82

    
83
.uk-list > li:nth-child(n+2),
84
.uk-list > li > ul { margin-top: @list-margin-top; }
85

    
86

    
87
/* Style modifiers
88
 ========================================================================== */
89

    
90
/*
91
 * Divider
92
 */
93

    
94
.uk-list-divider > li:nth-child(n+2) {
95
    margin-top: @list-divider-margin-top;
96
    padding-top: @list-divider-margin-top;
97
    border-top: @list-divider-border-width solid @list-divider-border;
98
    .hook-list-divider;
99
}
100

    
101
/*
102
 * Striped
103
 */
104

    
105
.uk-list-striped > li {
106
    padding: @list-striped-padding-vertical @list-striped-padding-horizontal;
107
    .hook-list-striped;
108
}
109

    
110
.uk-list-striped > li:nth-of-type(odd) { background: @list-striped-background; }
111

    
112
.uk-list-striped > li:nth-child(n+2) { margin-top: 0; }
113

    
114
/*
115
 * Bullet
116
 */
117

    
118
.uk-list-bullet > li {
119
    position: relative;
120
    padding-left: ~'calc(@{list-bullet-width} + @{list-bullet-margin-right})';
121
}
122

    
123
.uk-list-bullet > li::before {
124
    content: "";
125
    position: absolute;
126
    top: 0;
127
    left: 0;
128
    width: @list-bullet-width;
129
    height: @list-bullet-height;
130
    .svg-fill(@internal-list-bullet-image, "#000", @list-bullet-icon-color);
131
    background-repeat: no-repeat;
132
    background-position: 50% 50%;
133
    float: left;
134
    .hook-list-bullet;
135
}
136

    
137

    
138
/* Size modifier
139
 ========================================================================== */
140

    
141
.uk-list-large > li:nth-child(n+2),
142
.uk-list-large > li > ul { margin-top: @list-large-margin-top; }
143

    
144
/*
145
 * Divider
146
 */
147

    
148
.uk-list-large.uk-list-divider > li:nth-child(n+2) {
149
    margin-top: @list-large-divider-margin-top;
150
    padding-top: @list-large-divider-margin-top;
151
}
152

    
153
/*
154
 * Striped
155
 */
156

    
157
.uk-list-large.uk-list-striped > li {
158
    padding: @list-large-striped-padding-vertical @list-large-striped-padding-horizontal;
159
    .hook-list-striped;
160
}
161

    
162
.uk-list-large.uk-list-striped > li:nth-child(n+2) { margin-top: 0; }
163

    
164

    
165
// Hooks
166
// ========================================================================
167

    
168
.hook-list-misc;
169

    
170
.hook-list-divider() {}
171
.hook-list-striped() {}
172
.hook-list-bullet() {}
173
.hook-list-misc() {}
174

    
175

    
176
// Inverse
177
// ========================================================================
178

    
179
@inverse-list-divider-border:                     @inverse-global-border;
180
@inverse-list-striped-background:                 @inverse-global-muted-background;
181
@inverse-list-bullet-icon-color:                  @inverse-global-color;
182

    
183
.hook-inverse() {
184

    
185
    .uk-list-divider > li:nth-child(n+2) {
186
        border-top-color: @inverse-list-divider-border;
187
        .hook-inverse-list-divider;
188
    }
189

    
190
    .uk-list-striped > li {
191
        .hook-inverse-list-striped;
192
    }
193

    
194
    .uk-list-striped > li:nth-of-type(odd) { background-color: @inverse-list-striped-background; }
195

    
196
    .uk-list-bullet > li::before {
197
        .svg-fill(@internal-list-bullet-image, "#000", @inverse-list-bullet-icon-color);
198
        .hook-inverse-list-bullet;
199
    }
200

    
201
}
202

    
203
.hook-inverse-list-divider() {}
204
.hook-inverse-list-striped() {}
205
.hook-inverse-list-bullet() {}
(33-33/66)