_helpers.scss 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 for-width($width) {
  41. @media only screen and (max-width: $width) {
  42. @content;
  43. }
  44. }
  45. @mixin for-mobile {
  46. @include for-width($mobile-max-width) {
  47. @content;
  48. }
  49. }
  50. @mixin for-phone {
  51. @include for-width($phone-max-width) {
  52. @content;
  53. }
  54. }
  55. @keyframes spin { 100% { transform: rotate(360deg); } }
  56. @mixin font-icon {
  57. font-family: 'jet-icons';
  58. speak: none;
  59. font-style: normal;
  60. font-weight: normal;
  61. font-variant: normal;
  62. text-transform: none;
  63. line-height: 1;
  64. /* Better Font Rendering =========== */
  65. -webkit-font-smoothing: antialiased;
  66. -moz-osx-font-smoothing: grayscale;
  67. display: inline-block;
  68. }
  69. /// Convert angle
  70. /// @author Chris Eppstein
  71. /// @param {Number} $value - Value to convert
  72. /// @param {String} $unit - Unit to convert to
  73. /// @return {Number} Converted angle
  74. @function convert-angle($value, $unit) {
  75. $convertable-units: deg grad turn rad;
  76. $conversion-factors: 1 (10grad/9deg) (1turn/360deg) (3.1415926rad/180deg);
  77. @if index($convertable-units, unit($value)) and index($convertable-units, $unit) {
  78. @return $value
  79. / nth($conversion-factors, index($convertable-units, unit($value)))
  80. * nth($conversion-factors, index($convertable-units, $unit));
  81. }
  82. @warn "Cannot convert `#{unit($value)}` to `#{$unit}`.";
  83. }
  84. /// Test if `$value` is an angle
  85. /// @param {*} $value - Value to test
  86. /// @return {Bool}
  87. @function is-direction($value) {
  88. $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);
  89. $is-angle: type-of($value) == 'number' and index('deg' 'grad' 'turn' 'rad', unit($value));
  90. @return $is-direction or $is-angle;
  91. }
  92. /// Convert a direction to legacy syntax
  93. /// @param {Keyword | Angle} $value - Value to convert
  94. /// @require {function} is-direction
  95. /// @require {function} convert-angle
  96. @function legacy-direction($value) {
  97. @if is-direction($value) == false {
  98. @warn "Cannot convert `#{$value}` to legacy syntax because it doesn't seem to be an angle or a direction";
  99. }
  100. $conversion-map: (
  101. to top : bottom,
  102. to top right : bottom left,
  103. to right top : left bottom,
  104. to right : left,
  105. to bottom right : top left,
  106. to right bottom : left top,
  107. to bottom : top,
  108. to bottom left : top right,
  109. to left bottom : right top,
  110. to left : right,
  111. to left top : right bottom,
  112. to top left : bottom right
  113. );
  114. @if map-has-key($conversion-map, $value) {
  115. @return map-get($conversion-map, $value);
  116. }
  117. @return 90deg - convert-angle($value, 'deg');
  118. }
  119. /// Mixin printing a linear-gradient
  120. /// as well as a plain color fallback
  121. /// and the `-webkit-` prefixed declaration
  122. /// @access public
  123. /// @param {String | List | Angle} $direction - Linear gradient direction
  124. /// @param {Arglist} $color-stops - List of color-stops composing the gradient
  125. @mixin linear-gradient($direction, $color-stops...) {
  126. @if is-direction($direction) == false {
  127. $color-stops: ($direction, $color-stops);
  128. $direction: 180deg;
  129. }
  130. background: nth(nth($color-stops, 1), 1);
  131. background: -webkit-linear-gradient(legacy-direction($direction), $color-stops);
  132. background: linear-gradient($direction, $color-stops);
  133. }