mixins.scss 2.68 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 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 130 131 132 133 134 135 136 137 138 139 140 141 142
/**
 * Clearfix
 *
 * @return     {string}  Clearfix attribute
 */
@mixin clearfix {
	&:after {
		content: "";
		display: table;
		clear: both;
	}
}

/**
 * Placeholder attribute for inputs
 *
 * @return     {string}  Placeholder attributes
 */
@mixin placeholder {
	&::-webkit-input-placeholder {@content};
	&::-moz-placeholder {@content}
	&:-ms-input-placeholder {@content}
	&:placeholder-shown {@content};
}

/**
 * Spinner element
 *
 * @param      {string}  $color             - Color
 * @param      {string}  $dur               - Animation Duration
 * @param      {int}     $width             - Width
 * @param      {int}     $height  [$width]  - height
 *
 * @return     {string}  Spinner element
 */
@mixin spinner($color,$dur,$width,$height:$width) {
	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));
		}
	};
}

/**
 * Prefixes for keyframes
 *
 * @param      {string}  $animation-name          - The animation name
 *
 * @return     {string}  Prefixed keyframes attributes
 */
@mixin keyframes($animation-name) {
		@-webkit-keyframes #{$animation-name} {
				@content;
		}
		@-moz-keyframes #{$animation-name} {
				@content;
		}
		@-o-keyframes #{$animation-name} {
				@content;
		}
		@keyframes #{$animation-name} {
				@content;
		}
}

/**
 * Prefix function for browser compatibility
 *
 * @param      {string}  $property          - Property name
 * @param      {any}     $value             - Property value
 *
 * @return     {string}  Prefixed attributes
 */
@mixin prefix($property, $value) {
	-webkit-#{$property}: #{$value};
		 -moz-#{$property}: #{$value};
			-ms-#{$property}: #{$value};
			 -o-#{$property}: #{$value};
					#{$property}: #{$value};
}

/**
 * Layout Mixins
 */
@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;
  }
}