mixins.scss 3.14 KB
Newer Older
1
/**
Nick's avatar
Nick committed
2 3 4 5
* Placeholder attribute for inputs
*
* @return     {string}  Placeholder attributes
*/
6
@mixin placeholder {
Nick's avatar
Nick committed
7 8 9 10
  &::-webkit-input-placeholder {@content;}
  &::-moz-placeholder {@content;}
  &:-ms-input-placeholder {@content;}
  &:placeholder-shown {@content;}
11 12 13
}

/**
Nick's avatar
Nick committed
14 15 16 17 18 19 20 21 22
* Spinner element
*
* @param      {string}  $color             - Color
* @param      {string}  $dur               - Animation Duration
* @param      {int}     $width             - Width
* @param      {int}     $height  [$width]  - height
*
* @return     {string}  Spinner element
*/
23
@mixin spinner($color,$dur,$width,$height:$width) {
Nick's avatar
Nick committed
24 25 26 27 28 29 30 31 32 33
  width: $width;
  height: $height;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 2px 1px 0 $color;
  @include prefix(animation, spin $dur linear infinite);
  @include keyframes(spin) {
    100%{
      @include prefix(transform, rotate(360deg));
    }
  }
34 35 36
}

/**
Nick's avatar
Nick committed
37 38 39 40 41 42
* Prefixes for keyframes
*
* @param      {string}  $animation-name          - The animation name
*
* @return     {string}  Prefixed keyframes attributes
*/
43
@mixin keyframes($animation-name) {
Nick's avatar
Nick committed
44 45 46 47 48 49 50 51 52 53 54 55
  @-webkit-keyframes #{$animation-name} {
    @content;
  }
  @-moz-keyframes #{$animation-name} {
    @content;
  }
  @-o-keyframes #{$animation-name} {
    @content;
  }
  @keyframes #{$animation-name} {
    @content;
  }
56 57 58
}

/**
Nick's avatar
Nick committed
59 60 61 62 63 64 65
* Prefix function for browser compatibility
*
* @param      {string}  $property          - Property name
* @param      {any}     $value             - Property value
*
* @return     {string}  Prefixed attributes
*/
66
@mixin prefix($property, $value) {
Nick's avatar
Nick committed
67 68 69 70 71
  -webkit-#{$property}: #{$value};
  -moz-#{$property}: #{$value};
  -ms-#{$property}: #{$value};
  -o-#{$property}: #{$value};
  #{$property}: #{$value};
72 73 74
}

/**
Nick's avatar
Nick committed
75 76
* Layout Mixins
*/
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
@mixin from($device) {
  @media screen and (min-width: $device) {
    @content;
  }
}

@mixin until($device) {
  @media screen and (max-width: $device - 1px) {
    @content;
  }
}

@mixin mobile {
  @media screen and (max-width: $tablet - 1px) {
    @content;
  }
}

@mixin tablet {
  @media screen and (min-width: $tablet) {
    @content;
  }
}

@mixin tablet-only {
  @media screen and (min-width: $tablet) and (max-width: $desktop - 1px) {
    @content;
  }
}

@mixin touch {
  @media screen and (max-width: $desktop - 1px) {
    @content;
  }
}

@mixin desktop {
  @media screen and (min-width: $desktop) {
    @content;
  }
}

@mixin desktop-only {
  @media screen and (min-width: $desktop) and (max-width: $widescreen - 1px) {
    @content;
  }
}

@mixin widescreen {
  @media screen and (min-width: $widescreen) {
    @content;
  }
}
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149

// Nucleo Icons

@mixin nc-rotate($degrees, $rotation) {
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
  -webkit-transform: rotate($degrees);
  -moz-transform: rotate($degrees);
  -ms-transform: rotate($degrees);
  -o-transform: rotate($degrees);
  transform: rotate($degrees);
}

@mixin nc-flip($horiz, $vert, $rotation) {
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation});
  -webkit-transform: scale($horiz, $vert);
  -moz-transform: scale($horiz, $vert);
  -ms-transform: scale($horiz, $vert);
  -o-transform: scale($horiz, $vert);
  transform: scale($horiz, $vert);
}