-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom.scss
199 lines (177 loc) · 4.47 KB
/
custom.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
// ++++++++++++++++++ custom ++++++++++++++++++ //
@mixin antialiasing {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
// - font-weights - //
$fontWeights: (
thin: 100,
thin-italic: 100i,
extra-light: 200,
exta-light-italic: 200i,
light: 300,
light-italic: 300i,
regular: 400,
regular-italic: 400i,
medium: 500,
medium-italc: 500i,
semi-bold: 600,
semi-bold-italic: 600i,
bold: 700,
bold-italic: 700i,
extra-bold: 800,
extra-bold-italic: 800i,
black: 900,
black-italic: 900i
);
@function weigth($weight) {
@return map-get($fontWeights, $weight);
}
// - transition - //
@mixin transition($property, $duration) {
-webkit-transition: $property $duration;
-moz-transition: $property $duration;
-ms-transition: $property $duration;
-o-transition: $property $duration;
transition: $property $duration;
}
// @mixin transition-prop($property, $duration, $ease: ease-in-out, $delay: 0) {
// -webkit-transition: $property $duration $ease $delay;
// -moz-transition: $property $duration $ease $delay;
// -ms-transition: $property $duration $ease $delay;
// -o-transition: $property $duration $ease $delay;
// transition: $property $duration $ease $delay;
// }
// — link hover — //
@mixin link-hover($property, $duration, $color) {
&:hover {
@include transition($property, $duration);
color: $color;
}
}
// z-index
$z-index: (
modal: 200,
navigation: 100,
footer: 90,
triangle: 60,
navigation-rainbow: 50,
share-type: 41,
share: 40
);
@function z-index($key) {
@return map-get($z-index, $key);
}
@mixin z-index($key) {
z-index: z-index($key);
}
@mixin position($pos) {
@if $pos == "absolute" {
position: absolute;
}
@if $pos == "relative" {
position: relative;
}
@if $pos == "fixed" {
-webkit-position: fixed;
position: fixed;
}
@if $pos == "sticky" {
-webkit-position: sticky;
position: sticky;
}
}
// Define vertical, horizontal, or both position
@mixin center($position) {
position: absolute;
@if $position == "vertical" {
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
} @else if $position == "horizontal" {
left: 50%;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translate(-50%);
} @else if $position == "both" {
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
}
// Using the mixin
//.foo {
//@include center(both);
//}
//.foo-parent {
//position: relative;
//}
@mixin flexCenter($device) {
@if ($device == "desktop") {
display: flex;
align-items: center;
justify-content: center;
}
@if ($device == "mobile") {
display: flex;
align-items: center;
justify-content: center;
flex-flow: wrap column;
}
}
// 4 - Fullscreen Background Image
// --------------------------------
@mixin bg-cover($url) {
background: url($url) no-repeat center center fixed;
background-size: cover;
}
// 5 - Full Width/Height and Centered Image
// -------------------------------------------
// Position an image within it's parent element so that it
// takes up the full height and width of the parent element, and
// is positioned with its center in the middle
@mixin img-cover {
min-height: 100%;
width: 100%;
height: auto;
-o-object-fit: cover;
object-fit: cover;
}
// square:
@mixin square($value: 100px) {
width: $value;
height: $value;
}
// retina images:
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
background-image: url($image);
background-size: $width $height;
}
}
//Usage
div.logo {
background: url("logo.png") no-repeat;
@include image-2x("logo2x.png", 100px, 25px);
}
// font-face:
@mixin font-face($font-name, $file-name, $weight: normal, $style: normal) {
@font-face {
font-family: quote($font-name);
src: url($file-name+".eot");
src: url($file-name+".eot?#iefix") format("embedded-opentype"), url($file-name+".woff") format("woff"),
url($file-name+".ttf") format("truetype"), url($file-name+".svg##{$font-name}") format("svg");
font-weight: $weight;
font-style: $style;
}
}
//Usage
@include font-face("gotham", "/fonts/gotham");