source: main/waeup-hugo/public/sass/libs/_mixins.scss @ 15958

Last change on this file since 15958 was 14926, checked in by Henrik Bettermann, 7 years ago
File size: 1.7 KB
RevLine 
[14926]1/// Makes an element's :before pseudoelement a FontAwesome icon.
2/// @param {string} $content Optional content value to use.
3/// @param {string} $where Optional pseudoelement to target (before or after).
4@mixin icon($content: false, $where: before) {
5
6        text-decoration: none;
7
8        &:#{$where} {
9
10                @if $content {
11                        content: $content;
12                }
13
14                -moz-osx-font-smoothing: grayscale;
15                -webkit-font-smoothing: antialiased;
16                font-family: FontAwesome;
17                font-style: normal;
18                font-weight: normal;
19                text-transform: none !important;
20
21        }
22
23}
24
25/// Applies padding to an element, taking the current element-margin value into account.
26/// @param {mixed} $tb Top/bottom padding.
27/// @param {mixed} $lr Left/right padding.
28/// @param {list} $pad Optional extra padding (in the following order top, right, bottom, left)
29/// @param {bool} $important If true, adds !important.
30@mixin padding($tb, $lr, $pad: (0,0,0,0), $important: null) {
31
32        @if $important {
33                $important: '!important';
34        }
35
36        $x: 0.1em;
37
38        @if unit(_size(element-margin)) == 'rem' {
39                $x: 0.1rem;
40        }
41
42        padding: ($tb + nth($pad,1)) ($lr + nth($pad,2)) max($x, $tb - _size(element-margin) + nth($pad,3)) ($lr + nth($pad,4)) #{$important};
43
44}
45
46/// Encodes a SVG data URL so IE doesn't choke (via codepen.io/jakob-e/pen/YXXBrp).
47/// @param {string} $svg SVG data URL.
48/// @return {string} Encoded SVG data URL.
49@function svg-url($svg) {
50
51        $svg: str-replace($svg, '"', '\'');
52        $svg: str-replace($svg, '<', '%3C');
53        $svg: str-replace($svg, '>', '%3E');
54        $svg: str-replace($svg, '&', '%26');
55        $svg: str-replace($svg, '#', '%23');
56        $svg: str-replace($svg, '{', '%7B');
57        $svg: str-replace($svg, '}', '%7D');
58        $svg: str-replace($svg, ';', '%3B');
59
60        @return url("data:image/svg+xml;charset=utf8,#{$svg}");
61
62}
Note: See TracBrowser for help on using the repository browser.