andreascarpello
2/26/2015 - 4:41 PM

SASS MIXINS

SASS MIXINS

// http://www.sitepoint.com/using-sass-maps/
// http://hugogiraudel.com/2014/05/05/bringing-configuration-objects-to-sass/
@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);

    text-align: right;

    ul,
    ol {
        margin: 0;
        padding: 0;
    }
    #{$innerElement} {
        display: inline-block;
        list-style-type: none;
        margin: 0;
        padding-left: 5px;
        color: $linkColor;
        
        &: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) {
        text-align: left;
        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;
        }
    }

}