_helpers.scss 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. .hidden {
  2. display: none;
  3. }
  4. .clear-list {
  5. margin: 0;
  6. padding: 0;
  7. list-style: none;
  8. }
  9. .fl {
  10. float: left;
  11. }
  12. .fr {
  13. float: right;
  14. }
  15. .cf:before, .cf:after {
  16. content: "";
  17. display: table;
  18. }
  19. .cf:after {
  20. clear: both;
  21. }
  22. @each $class, $style in (p, padding), (pt, padding-top), (pr, padding-right), (pb, padding-bottom), (pl, padding-left),
  23. (m, margin), (mt, margin-top), (mr, margin-right), (mb, margin-bottom), (ml, margin-left) {
  24. @for $i from 1 through 8 {
  25. $value: $i * 10;
  26. .#{$class}#{$value} {
  27. #{$style}: #{$value}px;
  28. }
  29. }
  30. }
  31. .pos_rel {
  32. position: relative;
  33. }
  34. .pos_abs {
  35. position: absolute;
  36. }
  37. .fill_width {
  38. width: 100% !important;
  39. }
  40. @mixin placeholder {
  41. &::-webkit-input-placeholder {@content}
  42. &:-moz-placeholder {@content}
  43. &::-moz-placeholder {@content}
  44. &:-ms-input-placeholder {@content}
  45. }
  46. @mixin transition-all($duration) {
  47. -webkit-transition: all $duration;
  48. -moz-transition: all $duration;
  49. -o-transition: all $duration;
  50. transition: all $duration;
  51. }
  52. @function prefix($property, $prefixes: (webkit moz o ms)) {
  53. $vendor-prefixed-properties: transform background-clip background-size;
  54. $result: ();
  55. @each $prefix in $prefixes {
  56. @if index($vendor-prefixed-properties, $property) {
  57. $property: -#{$prefix}-#{$property}
  58. }
  59. $result: append($result, $property);
  60. }
  61. @return $result;
  62. }
  63. @function trans-prefix($transition, $prefix: moz) {
  64. $prefixed: ();
  65. @each $trans in $transition {
  66. $prop-name: nth($trans, 1);
  67. $vendor-prop-name: prefix($prop-name, $prefix);
  68. $prop-vals: nth($trans, 2);
  69. $prefixed: append($prefixed, ($vendor-prop-name $prop-vals), comma);
  70. }
  71. @return $prefixed;
  72. }
  73. @mixin transition($values...) {
  74. $transitions: ();
  75. @each $declaration in $values {
  76. $prop: nth($declaration, 1);
  77. $prop-opts: ();
  78. $length: length($declaration);
  79. @for $i from 2 through $length {
  80. $prop-opts: append($prop-opts, nth($declaration, $i));
  81. }
  82. $trans: ($prop, $prop-opts);
  83. $transitions: append($transitions, $trans, comma);
  84. }
  85. -webkit-transition: trans-prefix($transitions, webkit);
  86. -moz-transition: trans-prefix($transitions, moz);
  87. -o-transition: trans-prefix($transitions, o);
  88. transition: $values;
  89. }
  90. @mixin font-icon {
  91. font-family: 'jet-icons';
  92. speak: none;
  93. font-style: normal;
  94. font-weight: normal;
  95. font-variant: normal;
  96. text-transform: none;
  97. line-height: 1;
  98. /* Better Font Rendering =========== */
  99. -webkit-font-smoothing: antialiased;
  100. -moz-osx-font-smoothing: grayscale;
  101. display: inline-block;
  102. }
  103. /// Convert angle
  104. /// @author Chris Eppstein
  105. /// @param {Number} $value - Value to convert
  106. /// @param {String} $unit - Unit to convert to
  107. /// @return {Number} Converted angle
  108. @function convert-angle($value, $unit) {
  109. $convertable-units: deg grad turn rad;
  110. $conversion-factors: 1 (10grad/9deg) (1turn/360deg) (3.1415926rad/180deg);
  111. @if index($convertable-units, unit($value)) and index($convertable-units, $unit) {
  112. @return $value
  113. / nth($conversion-factors, index($convertable-units, unit($value)))
  114. * nth($conversion-factors, index($convertable-units, $unit));
  115. }
  116. @warn "Cannot convert `#{unit($value)}` to `#{$unit}`.";
  117. }
  118. /// Test if `$value` is an angle
  119. /// @param {*} $value - Value to test
  120. /// @return {Bool}
  121. @function is-direction($value) {
  122. $is-direction: index((to top, to top right, to right top, to right, to bottom right, to right bottom, to bottom, to bottom left, to left bottom, to left, to left top, to top left), $value);
  123. $is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value));
  124. @return $is-direction or $is-angle;
  125. }
  126. /// Convert a direction to legacy syntax
  127. /// @param {Keyword | Angle} $value - Value to convert
  128. /// @require {function} is-direction
  129. /// @require {function} convert-angle
  130. @function legacy-direction($value) {
  131. @if is-direction($value) == false {
  132. @warn "Cannot convert `#{$value}` to legacy syntax because it doesn't seem to be an angle or a direction";
  133. }
  134. $conversion-map: (
  135. to top : bottom,
  136. to top right : bottom left,
  137. to right top : left bottom,
  138. to right : left,
  139. to bottom right : top left,
  140. to right bottom : left top,
  141. to bottom : top,
  142. to bottom left : top right,
  143. to left bottom : right top,
  144. to left : right,
  145. to left top : right bottom,
  146. to top left : bottom right
  147. );
  148. @if map-has-key($conversion-map, $value) {
  149. @return map-get($conversion-map, $value);
  150. }
  151. @return 90deg - convert-angle($value, 'deg');
  152. }
  153. /// Mixin printing a linear-gradient
  154. /// as well as a plain color fallback
  155. /// and the `-webkit-` prefixed declaration
  156. /// @access public
  157. /// @param {String | List | Angle} $direction - Linear gradient direction
  158. /// @param {Arglist} $color-stops - List of color-stops composing the gradient
  159. @mixin linear-gradient($direction, $color-stops...) {
  160. @if is-direction($direction) == false {
  161. $color-stops: ($direction, $color-stops);
  162. $direction: 180deg;
  163. }
  164. background: nth(nth($color-stops, 1), 1);
  165. background: -webkit-linear-gradient(legacy-direction($direction), $color-stops);
  166. background: linear-gradient($direction, $color-stops);
  167. }