This repository has been archived by the owner on Oct 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
_o-list.scss
230 lines (177 loc) · 4.63 KB
/
_o-list.scss
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
/* ============================================================================
@OBJECTS -> LIST
========================================================================= */
/**
* Standard list styles for unordered and ordered lists as they're removed in
* Core -> Reset.
*
* @markup
<ul class="o-list">
<li>Lorem</li>
<li>Aliquam</li>
<li>Vestibulum</li>
</ul>
<ol class="o-list">
<li>Lorem</li>
<li>Aliquam</li>
<li>Vestibulum</li>
</ol>
*
* @demo
* http://codepen.io/chris-pearce/full/gbVLwy/
*/
/**
* Settings.
*/
/**
* Toggle on/off certain styles and treatments.
*/
/**
* Margins.
*/
$o-list-apply-bottom-margin: true !default;
$o-list-apply-top-bottom-margin-to-nested: false !default;
/**
* Hanging bullets.
*/
$o-list-apply-hanging-bullets: false !default;
/**
* Apply at these breakpoints (turned off by default).
*/
$o-list-apply-at-breakpoints: $default-breakpoints !default;
// From the above breakpoints choose what you wish to apply it too
$o-list-apply-at-breakpoints-for-default: false !default;
$o-list-apply-at-breakpoints-for-unordered: false !default;
$o-list-apply-at-breakpoints-for-ordered: false !default;
$o-list-apply-at-breakpoints-for-nested: false !default;
/**
* Margins.
*/
$o-list-bottom-margin: $spacing-base !default;
$o-list-nested-top-bottom-margin: $o-list-bottom-margin / 2 !default;
/**
* Left indentation.
*/
$o-list-indent: $o-list-bottom-margin !default;
/**
* Bullets.
*/
$o-list-bullet-unordered-base: disc !default;
$o-list-bullet-unordered-nested-once: circle !default;
$o-list-bullet-unordered-nested-twice: square !default;
$o-list-bullet-ordered: decimal !default;
%o-list,
.o-list {
// Apply bottom spacing
@if $o-list-apply-bottom-margin {
@include to-rem(margin-bottom, $o-list-bottom-margin);
// Remove from the last child
&:last-child {
margin-bottom: 0;
}
}
// Apply hanging bullets
@if $o-list-apply-hanging-bullets {
list-style-position: outside;
}
@else {
@include to-rem(margin-left, $o-list-indent);
}
}
@if $o-list-apply-at-breakpoints-for-default {
@include generate-at-breakpoints('.o-list', $o-list-apply-at-breakpoints) {
@if $o-list-apply-bottom-margin {
@include to-rem(margin-bottom, $o-list-bottom-margin);
&:last-child {
margin-bottom: 0;
}
}
@if $o-list-apply-hanging-bullets {
list-style-position: outside;
}
@else {
@include to-rem(margin-left, $o-list-indent);
}
}
}
/**
* Bullets.
*
* For unordered lists we're replicating the native browser bullets:
* - disc
* -- circle
* --- square
*/
// Unordered lists
%ul.o-list,
ul.o-list {
list-style-type: $o-list-bullet-unordered-base;
}
@if $o-list-apply-at-breakpoints-for-unordered {
@include generate-at-breakpoints('ul.o-list', $o-list-apply-at-breakpoints) {
list-style-type: $o-list-bullet-unordered-base;
}
}
// Ordered lists
%ol.o-list,
ol.o-list {
list-style-type: $o-list-bullet-ordered;
}
@if $o-list-apply-at-breakpoints-for-ordered {
@include generate-at-breakpoints('ol.o-list', $o-list-apply-at-breakpoints) {
list-style-type: $o-list-bullet-ordered;
}
}
/**
* Nested lists.
*/
%o-list,
.o-list {
// Apply spacing between the lists
@if $o-list-apply-top-bottom-margin-to-nested {
ul,
ol {
@include to-rem(margin-bottom margin-top, $o-list-nested-top-bottom-margin);
}
}
// Left indentation
ul,
ol {
@include to-rem(margin-left, $o-list-indent);
}
// Unordered list bullets
ul {
list-style-type: $o-list-bullet-unordered-nested-once;
ul {
list-style-type: $o-list-bullet-unordered-nested-twice;
}
}
// Ordered list bullets
ol {
list-style-type: $o-list-bullet-ordered;
}
}
@if $o-list-apply-at-breakpoints-for-nested {
@include generate-at-breakpoints(".o-list",
$o-list-apply-at-breakpoints) {
@if $o-list-apply-top-bottom-margin-to-nested {
ul,
ol {
@include to-rem(margin-bottom margin-top, $o-list-nested-top-bottom-margin);
}
}
ul,
ol {
@include to-rem(margin-left, $o-list-indent);
}
ul {
list-style-type: $o-list-bullet-unordered-nested-once;
ul {
list-style-type: $o-list-bullet-unordered-nested-twice;
}
}
ol {
list-style-type: $o-list-bullet-ordered;
}
}
}