You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
2.7 KiB

  1. /**
  2. * Clearfix
  3. *
  4. * @return {string} Clearfix attribute
  5. */
  6. @mixin clearfix {
  7. &:after {
  8. content: "";
  9. display: table;
  10. clear: both;
  11. }
  12. }
  13. /**
  14. * Placeholder attribute for inputs
  15. *
  16. * @return {string} Placeholder attributes
  17. */
  18. @mixin placeholder {
  19. &::-webkit-input-placeholder {@content};
  20. &::-moz-placeholder {@content}
  21. &:-ms-input-placeholder {@content}
  22. &:placeholder-shown {@content};
  23. }
  24. /**
  25. * Spinner element
  26. *
  27. * @param {string} $color - Color
  28. * @param {string} $dur - Animation Duration
  29. * @param {int} $width - Width
  30. * @param {int} $height [$width] - height
  31. *
  32. * @return {string} Spinner element
  33. */
  34. @mixin spinner($color,$dur,$width,$height:$width) {
  35. width: $width;
  36. height: $height;
  37. border-radius: 50%;
  38. box-shadow:0 0 0 1px rgba(0,0,0,0.1), 2px 1px 0 $color;
  39. @include prefix(animation, spin $dur linear infinite);
  40. @include keyframes(spin) {
  41. 100%{
  42. @include prefix(transform, rotate(360deg));
  43. }
  44. };
  45. }
  46. /**
  47. * Prefixes for keyframes
  48. *
  49. * @param {string} $animation-name - The animation name
  50. *
  51. * @return {string} Prefixed keyframes attributes
  52. */
  53. @mixin keyframes($animation-name) {
  54. @-webkit-keyframes #{$animation-name} {
  55. @content;
  56. }
  57. @-moz-keyframes #{$animation-name} {
  58. @content;
  59. }
  60. @-o-keyframes #{$animation-name} {
  61. @content;
  62. }
  63. @keyframes #{$animation-name} {
  64. @content;
  65. }
  66. }
  67. /**
  68. * Prefix function for browser compatibility
  69. *
  70. * @param {string} $property - Property name
  71. * @param {any} $value - Property value
  72. *
  73. * @return {string} Prefixed attributes
  74. */
  75. @mixin prefix($property, $value) {
  76. -webkit-#{$property}: #{$value};
  77. -moz-#{$property}: #{$value};
  78. -ms-#{$property}: #{$value};
  79. -o-#{$property}: #{$value};
  80. #{$property}: #{$value};
  81. }
  82. /**
  83. * Layout Mixins
  84. */
  85. @mixin from($device) {
  86. @media screen and (min-width: $device) {
  87. @content;
  88. }
  89. }
  90. @mixin until($device) {
  91. @media screen and (max-width: $device - 1px) {
  92. @content;
  93. }
  94. }
  95. @mixin mobile {
  96. @media screen and (max-width: $tablet - 1px) {
  97. @content;
  98. }
  99. }
  100. @mixin tablet {
  101. @media screen and (min-width: $tablet) {
  102. @content;
  103. }
  104. }
  105. @mixin tablet-only {
  106. @media screen and (min-width: $tablet) and (max-width: $desktop - 1px) {
  107. @content;
  108. }
  109. }
  110. @mixin touch {
  111. @media screen and (max-width: $desktop - 1px) {
  112. @content;
  113. }
  114. }
  115. @mixin desktop {
  116. @media screen and (min-width: $desktop) {
  117. @content;
  118. }
  119. }
  120. @mixin desktop-only {
  121. @media screen and (min-width: $desktop) and (max-width: $widescreen - 1px) {
  122. @content;
  123. }
  124. }
  125. @mixin widescreen {
  126. @media screen and (min-width: $widescreen) {
  127. @content;
  128. }
  129. }