Last active
January 18, 2018 18:48
-
-
Save andreascarpello/ac769d14588b52950d16 to your computer and use it in GitHub Desktop.
SCSS mixins
This file contains 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
@mixin horizontal-menu($conf) { | |
$orientation: map-get($conf, orientation); | |
li { | |
@if $orientation == 'horizontal' { | |
display: block; | |
} @else { | |
display: inline-block; | |
} | |
a { | |
color: map-get($conf, color); | |
font: 300 16px 'Source Sans Pro'; | |
@if map-has-key($conf, border) { | |
border-left: 1px solid map-get($conf, color); | |
} | |
display: inline-block; | |
} | |
&.last a { | |
@if (map-get($conf, border)) { | |
border-right: 1px solid map-get($conf, color); | |
} | |
} | |
& a:hover { | |
color: darken(map-get($conf, color), 20%); | |
} | |
} | |
} | |
@mixin squared-button ($color: $buttercup) { | |
padding: 3px 10px; | |
border-radius: 0; | |
background-color: $color; | |
font: 600 14px / 24px 'Source Sans Pro'; | |
@if (lightness($color) > 50) { | |
color: #333; | |
} @else { | |
color: $white; | |
} | |
-webkit-transition: background-color 0.4s ease; | |
-moz-transition: background-color 0.4s ease; | |
-o-transition: background-color 0.4s ease; | |
transition: background-color 0.4s ease; | |
&:after { | |
@extend %base-font; | |
@extend .icon-arrow-right:before; | |
vertical-align: middle; | |
} | |
&:hover { | |
background-color: darken($color, 5); | |
} | |
} | |
@mixin breadcrumb ($options: ()) { | |
// Extending the default arguments with the given object | |
$configuration: map-merge(( | |
innerElement: li, | |
linkColor: #999, | |
lastChildColor: #000, | |
), $options); | |
$innerElement: map-get($configuration, innerElement); | |
$linkColor: map-get($configuration, linkColor); | |
$lastChildColor: map-get($configuration, lastChildColor); | |
ul, | |
ol { | |
margin: 0; | |
padding: 0; | |
} | |
#{$innerElement} { | |
display: inline-block; | |
list-style-type: none; | |
margin: 0; | |
padding-left: 5px; | |
color: $linkColor; | |
&:first-child { | |
padding-left: 0; | |
} | |
&:last-child { | |
color: $lastChildColor; | |
text-decoration: none; | |
} | |
} | |
a { | |
color: $linkColor; | |
padding-right: 4px; | |
display: inline-block; | |
text-transform: lowercase; | |
&:hover { | |
text-decoration: underline; | |
} | |
} | |
a:first-letter, | |
#{$innerElement}:first-letter { | |
text-transform: uppercase; | |
} | |
@media (max-width: 480px) { | |
margin: 20px 0; | |
color: transparent; | |
#{$innerElement} { | |
padding: 0; | |
width: 100%; | |
display: block; | |
box-sizing: border-box; | |
} | |
#{$innerElement} ~ #{$innerElement}:before { | |
content: ''; | |
display: inline-block; | |
width: 8px; | |
height: 8px; | |
border-left: 1px solid $linkColor; | |
border-bottom: 1px solid $linkColor; | |
margin: 0px 6px 2px 0px; | |
} | |
#{$innerElement} ~ #{$innerElement} { | |
padding-left: 10px; | |
} | |
#{$innerElement} ~ #{$innerElement} ~ #{$innerElement} { | |
padding-left: 20px; | |
} | |
#{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} { | |
padding-left: 30px; | |
} | |
#{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} { | |
padding-left: 40px; | |
} | |
#{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} ~ #{$innerElement} { | |
padding-left: 50px; | |
} | |
} | |
} | |
@mixin icon($icon) { | |
// @extend [data-icon]:before; | |
font-family: "biaglut-font" !important; | |
font-style: normal !important; | |
font-weight: normal !important; | |
font-variant: normal !important; | |
text-transform: none !important; | |
speak: none; | |
line-height: 1; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
@extend .#{$icon}:before; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment