website

The files for mattfehrenbach.xyz, a fork of a template.
git clone git://git.mattfehrenbach.xyz/website.git
Log | Files | Refs | LICENSE

_mixins.scss (2218B)


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