Last active
May 20, 2019 14:03
-
-
Save lucianobarauna/93c1b89276ae6621a82a2122976d7f9e to your computer and use it in GitHub Desktop.
My helpers of mixings sass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mixing to use font 2.0 | |
@mixin useFont($fontFamily, $fontSize: false){ | |
// $valueFont = Font family + websafe fonts | |
$valueFont: #{$fontFamily, Arial, Verdana, Times}; | |
@if $fontSize != false { | |
font: $fontSize $valueFont; | |
} @else { | |
font-family: $valueFont; | |
} | |
} | |
// Use | |
.texto { | |
@include useFont('Tahoma', 120px) | |
} | |
// Media query | |
// Media querys | |
@mixin media-max($size){ | |
@media (max-width: $size) { | |
@content; | |
} | |
} | |
@mixin media-min($size){ | |
@media (min-width: $size) { | |
@content; | |
} | |
} | |
// Choose multiple fonts family | |
$typeFontSize: null !default | |
$typeFontWeight: null !default | |
$typeFontStyle: null !default | |
=fontFamily($fontFamilyName, $fontFamilyNameType, $fontSize: $typeFontSize, $fontWeight: $typeFontWeight, $fontStyle: $typeFontStyle) | |
@if($fontFamilyName == 'roboto') | |
font-family: '#{$fontFamilyName}_#{$fontFamilyNameType}' | |
@else if($fontFamilyName == 'bar') | |
font-family: '#{$fontFamilyName}_#{$fontFamilyNameType}' | |
@else | |
font-family: 'Arial' | |
@if $fontSize != $typeFontSize | |
font-size: $fontSize | |
@if $fontWeight != $typeFontWeight | |
font-weight: $fontWeight | |
@if $fontStyle != $typeFontStyle | |
font-style: $fontStyle | |
.teste | |
color: red | |
+fontFamily(roboto, light, 10px, null, bold) | |
// Result | |
// .teste { | |
// color: red; | |
// font-family: "roboto_light"; | |
// font-size: 10px; | |
// font-style: bold; | |
// } | |
// Chosse google fonts | |
$typeFontStyleGoogle: normal !default | |
$typeFontWeightGoogle: 400 !default | |
$typeFontSizeGoogle: null !default | |
=fontGoogle($familyFont, $fontSize: $typeFontSizeGoogle, $fontWeight: $typeFontWeightGoogle, $typeFont: $typeFontStyleGoogle) | |
font-family: #{$familyFont} ,Arial, sans-serif | |
@if $fontSize != $typeFontSizeGoogle | |
font-weight: $fontSize | |
@else | |
font-weight: $fontWeight | |
@if $fontWeight == $typeFontWeightGoogle | |
font-weight: $typeFontWeightGoogle | |
@else | |
font-weight: $fontWeight | |
@if $typeFont == $typeFontStyleGoogle | |
font-style: $typeFontStyleGoogle | |
@else | |
font-style: $typeFont | |
// Media querys | |
=mediaMin($width) | |
@media screen and (min-width: $width) | |
@content; | |
=mediaMax($width) | |
@media screen and (max-width: $width) | |
@content; | |
// Background size | |
=bgSizeImg($w, $h) | |
width: $w | |
height: $h | |
overflow: hidden | |
background-size: contain | |
// Placeholder mixin | |
=placeholder | |
$placeholders: ':-moz' ':-webkit-input' '-moz' '-ms-input' | |
@each $placeholder in $placeholders | |
&:#{$placeholder}-placeholder | |
@content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment