/
utility-belt.scss
277 lines (254 loc) · 6.41 KB
/
utility-belt.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*
* UtilityBelt - a starter kit for any SASS project
* By @dmtintner & @hackingui
* Documentation and examples - hackingui.com/front-end/10-best-scss-utilities/
* V1.2.0
*/
/*
## Triangle
* @include triangle within a pseudo element and add positioning properties (ie. top, left)
* $direction: up, down, left, right
*/
@mixin triangle($direction, $size: 8px, $color: #222) {
content: '';
display: block;
position: absolute;
height: 0;
width: 0;
@if ($direction == 'up') {
border-bottom: $size solid $color;
border-left: $size solid transparent;
border-right: $size solid transparent;
border-top: none;
} @else if ($direction == 'down') {
border-top: $size solid $color;
border-left: $size solid transparent;
border-right: $size solid transparent;
border-bottom: none;
} @else if ($direction == 'left') {
border-top: $size solid transparent;
border-bottom: $size solid transparent;
border-right: $size solid $color;
border-left: none;
} @else if ($direction == 'right') {
border-top: $size solid transparent;
border-bottom: $size solid transparent;
border-left: $size solid $color;
border-right: none;
}
}
/*
* Currency
*/
%currency {
position: relative;
&:before {
content: '$';
position: relative;
left: 0;
}
}
.USD %currency:before {
content: '$';
}
.EUR %currency:before {
content: '\20AC';
}
// must escape the html entities for each currency symbol
.ILS %currency:before {
content: '\20AA';
}
.GBP %currency:before {
content: '\00A3';
}
/*
* Clearfix
*/
%clearfix {
*zoom: 1;
&:after {
content: '';
display: table;
line-height: 0;
clear: both;
}
}
/*
* Respond To
*/
// Breakpoints for each query
$smartphone: 568px;
//iphone 5
$tabletPortrait: 767px;
$tabletLandscape: 1024px;
$desktop: 1174px;
$largeScreen: 1400px;
$mediumDesktop: 1200px;
@mixin respondTo($media) {
@if $media == smartphone {
@media (max-width: $smartphone) {
@content;
}
} @else if $media == tablet {
@media (min-width: $tabletPortrait) and (max-width: $tabletLandscape) {
@content;
}
} @else if $media == smallScreen {
@media (max-width: $desktop) {
@content;
}
} @else if $media == desktop {
@media (min-width: $desktop) {
@content;
}
} @else if $media == mediumDesktop {
@media (max-width: $mediumDesktop) {
@content;
}
} @else if $media == largeScreen {
@media (max-width: $largeScreen) {
@content;
}
}
}
/*
* Ghost Vertical Align
*/
@mixin ghostVerticalAlign($pseudoEl: before) {
&:#{$pseudoEl} {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
width: .1px;
}
}
%vertical-align {
@include ghostVerticalAlign();
}
/*
* Truncate Text
the mixin is used for shortening long captions
overflowing text is replaced by "..."
*/
@mixin truncateText($overflow: ellipsis) {
overflow: hidden;
white-space: nowrap;
text-overflow: $overflow; // values are: clip, ellipsis, or a string
}
@keyframes alertMe {
from {
border-width: 3px;
border-color: gold;
}
to {
border-width: 0;
border-color: rgba(gold, .1);
}
}
@mixin alerted() {
&:before {
content: '';
position: absolute;
top: 6px;
right: 6px;
height: 8px;
width: 8px;
border-radius: 10px;
background-color: gold;
}
&:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 20px;
width: 20px;
border-radius: 20px;
background-color: transparent;
border: solid gold;
border-width: 2px; // animates
box-sizing: border-box;
animation: alertMe 1000ms infinite ease 0ms;
}
}
/*
* Resize Sprite - for resizing only a single image from a sprite
*
* params: $map = $<name>-sprites (ex. $icon-sprites)
* $sprite = file name w/o file type ending (ex. globe)
$percent = number (ex. 50)
*
* (if compass CSS3 mixins not included, uncomment the background-size row and comment the @include version)
*/
@mixin resize-sprite($sprite, $percent) {
$width: map-get($sprite, 'width');
$height: map-get($sprite, 'height');
$total_width: map-get($sprite, 'total_width');
$total_height: map-get($sprite, 'total_height');
$offset_x: ceil(map-get($sprite, 'offset_x')*($percent/100));
$offset_y: ceil(map-get($sprite, 'offset_y')*($percent/100));
.app-sprite-#{map-get($sprite, 'name')} {
background-size: ceil($total_width * ($percent/100)) ceil($total_height * ($percent/100));
width: ceil($width*($percent/100));
height: ceil($height*($percent/100));
background-position: $offset_x $offset_y;
}
}
/*
* Resizes all images in a given sprite
* mixin courtesy of Wilker Lúcio https://gist.github.com/wilkerlucio/6442309
* params: $only = if you want to list specific files instead of regenerating every image (ex. globe, checkmark)
*/
@mixin resize-sprite-set($sprite-set, $percent) {
@each $name, $sprite in $sprite-set {
}
}
/*
## Text-align justify
For perfectly aligned grids that don't rely on floating elements and difficult calculations
- http://www.barrelny.com/blog/text-align-justify-and-rwd/ */
%justify {
text-align: justify;
&:after {
// adds a false last line to the content so justify is applied
content: '';
display: inline-block;
width: 100%;
}
}
/*
## Placeholder Color - for styling input placeholders in every browser
*/
@mixin placeholderColor($color) {
&::-webkit-input-placeholder {
-webkit-transition: color 200ms;
color: $color;
}
&:-moz-placeholder {
//Firefox 18-
-moz-transition: color 200ms;
color: $color;
}
&::-moz-placeholder {
-moz-transition: color 200ms;
color: $color;
}
&:-ms-input-placeholder {
color: $color;
}
}
%customScrollBar {
&::-webkit-scrollbar {
width: 11px;
}
&::-webkit-scrollbar-button {
display: none;
}
&::-webkit-scrollbar-track {
}
&::-webkit-scrollbar-thumb {
border-left: 8px solid;
border-color: #7A8CA2;
}
}