splitted up stylesheet and added lots of scaffolding to it. Style needs working.
[theme-danix.xyz.git] / assets / sass / libs / _mixins.scss
CommitLineData
748286b5 1/// Makes an element's :before pseudoelement a FontAwesome icon.\r
2/// @param {string} $content Optional content value to use.\r
3/// @param {string} $category Optional category to use.\r
4/// @param {string} $where Optional pseudoelement to target (before or after).\r
5@mixin icon($content: false, $category: regular, $where: before) {\r
6\r
7 text-decoration: none;\r
8\r
9 &:#{$where} {\r
10\r
11 @if $content {\r
12 content: $content;\r
13 }\r
14\r
15 -moz-osx-font-smoothing: grayscale;\r
16 -webkit-font-smoothing: antialiased;\r
17 display: inline-block;\r
18 font-style: normal;\r
19 font-variant: normal;\r
20 text-rendering: auto;\r
21 line-height: 1;\r
22 text-transform: none !important;\r
23\r
24 @if ($category == brands) {\r
25 font-family: 'Font Awesome 5 Brands';\r
26 }\r
27 @elseif ($category == solid) {\r
28 font-family: 'Font Awesome 5 Free';\r
29 font-weight: 900;\r
30 }\r
31 @else {\r
32 font-family: 'Font Awesome 5 Free';\r
33 font-weight: 400;\r
34 }\r
35\r
36 }\r
37\r
38}\r
39\r
40/// Applies padding to an element, taking the current element-margin value into account.\r
41/// @param {mixed} $tb Top/bottom padding.\r
42/// @param {mixed} $lr Left/right padding.\r
43/// @param {list} $pad Optional extra padding (in the following order top, right, bottom, left)\r
44/// @param {bool} $important If true, adds !important.\r
45@mixin padding($tb, $lr, $pad: (0,0,0,0), $important: null) {\r
46\r
47 @if $important {\r
48 $important: '!important';\r
49 }\r
50\r
51 $x: 0.1em;\r
52\r
53 @if unit(_size(element-margin)) == 'rem' {\r
54 $x: 0.1rem;\r
55 }\r
56\r
57 padding: ($tb + nth($pad,1)) ($lr + nth($pad,2)) max($x, $tb - _size(element-margin) + nth($pad,3)) ($lr + nth($pad,4)) #{$important};\r
58\r
59}\r
60\r
61/// Encodes a SVG data URL so IE doesn't choke (via codepen.io/jakob-e/pen/YXXBrp).\r
62/// @param {string} $svg SVG data URL.\r
63/// @return {string} Encoded SVG data URL.\r
64@function svg-url($svg) {\r
65\r
66 $svg: str-replace($svg, '"', '\'');\r
67 $svg: str-replace($svg, '%', '%25');\r
68 $svg: str-replace($svg, '<', '%3C');\r
69 $svg: str-replace($svg, '>', '%3E');\r
70 $svg: str-replace($svg, '&', '%26');\r
71 $svg: str-replace($svg, '#', '%23');\r
72 $svg: str-replace($svg, '{', '%7B');\r
73 $svg: str-replace($svg, '}', '%7D');\r
74 $svg: str-replace($svg, ';', '%3B');\r
75\r
76 @return url("data:image/svg+xml;charset=utf8,#{$svg}");\r
77\r
78}