DevInSantos/DevInSantos-events

View on GitHub
app/assets/stylesheets/base/_mixins.scss

Summary

Maintainability
Test Coverage
@mixin border-radius($radius) {
    -webkit-border-radius: $radius;
     -khtml-border-radius: $radius;
           -moz-border-radius: $radius;
                    border-radius: $radius;
}

@mixin border-top-radius($radius) {
    -webkit-border-top-left-radius: $radius;
 -webkit-border-top-right-radius: $radius;
             -moz-border-radius-topleft: $radius;
         -moz-border-radius-topright: $radius;
                    border-top-left-radius: $radius;
                 border-top-right-radius: $radius;
}

@mixin inline-block {
    display: inline-block;
    *display: inline;
    zoom: 1;
}

@mixin box-shadow($color, $hoffset, $voffset, $blur) {
  -webkit-box-shadow: $color $hoffset $voffset $blur;
       -moz-box-shadow: $color $hoffset $voffset $blur;
                  box-shadow: $color $hoffset $voffset $blur;
}

@mixin box-shadow-none {
  -webkit-box-shadow: none;
       -moz-box-shadow: none;
                  box-shadow: none;
}

// returns unitless number
@function remove-unit($number) {
    $unit: unit($number);
    $one: 1;
    
    @if $unit == 'px' { $one: 1px; }
    @if $unit == 'em' { $one: 1em; }
    @if $unit == '%' { $one: 1%; }
    
    @return $number / $one;
}

// returns flexible value
// returns 'em' by default, accepts '%' as format
@function flex($target, $context: 16, $unit: 'em') {
    $size: remove-unit($target) / remove-unit($context);
    
    @if $unit == 'em' { @return #{$size}em; }
    @if $unit == '%' { @return percentage($size); }
}

// alias to 'flex' function, using '%' as format
@function perc($target, $context: 16) {
    @return flex($target, $context, '%');
}

// alias to 'flex' function, using '%' as format
@function em($target, $context: 16) {
    @return flex($target, $context, 'em');
}