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.

315 lines
6.7 KiB

4 years ago
  1. @mixin breakpoint($min: 0, $max: 0) {
  2. $query: "all" !default;
  3. @if $min != 0 and $max != 0 { $query: "(min-width: #{$min}) and (max-width: #{$max})"; }
  4. @else if $min != 0 and $max == 0 { $query: "(min-width: #{$min})"; }
  5. @else if $min == 0 and $max != 0 { $query: "(max-width: #{$max})"; }
  6. @media #{$query} { @content; }
  7. }
  8. @mixin for-mobile() {
  9. @media only screen and (max-width: $sm - 1) { @content; }
  10. }
  11. @mixin not-mobile() {
  12. @media only screen and (min-width: $sm) { @content; }
  13. }
  14. // display
  15. @mixin flex {
  16. display: flex;
  17. }
  18. // basis
  19. @mixin flex-basis($width) {
  20. flex-basis: $width;
  21. }
  22. // items wrap
  23. @mixin flex-items-wrap {
  24. flex-wrap: wrap;
  25. }
  26. // items nowrap
  27. @mixin flex-items-nowrap {
  28. flex-wrap: nowrap;
  29. }
  30. // items row
  31. @mixin flex-items-row {
  32. flex-direction: row;
  33. }
  34. // items columns
  35. @mixin flex-items-column {
  36. flex-direction: column;
  37. }
  38. // items left
  39. @mixin flex-items-left {
  40. justify-content: flex-start;
  41. }
  42. // items right
  43. @mixin flex-items-right {
  44. justify-content: flex-end;
  45. }
  46. // items center
  47. @mixin flex-items-center {
  48. justify-content: center;
  49. }
  50. // items between
  51. @mixin flex-items-space-between {
  52. justify-content: space-between;
  53. }
  54. // items around
  55. @mixin flex-items-space-around {
  56. justify-content: space-around;
  57. }
  58. // items vertical top
  59. @mixin flex-items-baseline {
  60. align-items: baseline;
  61. }
  62. @mixin flex-items-top {
  63. align-items: flex-start;
  64. }
  65. // items vertical middle
  66. @mixin flex-items-middle {
  67. align-items: center;
  68. }
  69. // items vertical bottom
  70. @mixin flex-items-bottom {
  71. align-items: flex-end;
  72. }
  73. // item grow
  74. @mixin flex-item-grow($grow: 0) {
  75. flex-grow: $grow;
  76. }
  77. // item auto
  78. @mixin flex-item-auto {
  79. flex: auto;
  80. }
  81. // item one
  82. @mixin flex-item-one {
  83. flex: 1;
  84. }
  85. // item shrink
  86. @mixin flex-item-shrink($num: 0) {
  87. flex-shrink: $num;
  88. }
  89. // item width
  90. @mixin flex-item-width($width) {
  91. flex: 0 0 $width;
  92. max-width: $width;
  93. @include for-mobile() {
  94. flex: 0;
  95. max-width: 100%;
  96. }
  97. }
  98. // container
  99. @mixin make-container {
  100. display: flex;
  101. flex: 1;
  102. @include for-mobile {
  103. flex-direction: column;
  104. }
  105. }
  106. @mixin make-container-row {
  107. display: flex;
  108. flex: 1;
  109. }
  110. @mixin make-container-column {
  111. display: flex;
  112. flex-direction: column;
  113. flex: 1;
  114. }
  115. // middle
  116. @mixin make-items-middle {
  117. @include flex-items-middle;
  118. @include for-mobile {
  119. @include flex-items-left;
  120. align-items: flex-start;
  121. }
  122. }
  123. // content
  124. @mixin make-content {
  125. flex: 1;
  126. min-width: 0;
  127. }
  128. // sidebar
  129. @mixin make-sidebar($width) {
  130. @include flex-item-width($width);
  131. }
  132. // offset
  133. @mixin make-gap-offset($width) {
  134. margin-left: calc($width + #{$grid-gap}) !important;
  135. }
  136. @mixin make-button($color-back, $color-text) {
  137. color: $color-text;
  138. background-color: $color-back;
  139. &:hover {
  140. color: $color-text;
  141. background-color: lighten($color-back, 10%);
  142. }
  143. &:disabled,
  144. &.is-disabled {
  145. color: #fff;
  146. background-color: rgba($color-black, .5);
  147. }
  148. &.is-secondary {
  149. background: none;
  150. border: $button-secondary-border-width solid $color-back;
  151. color: $color-back;
  152. &:hover {
  153. color: rgba($color-text, .95);
  154. background-color: $color-back;
  155. border-color: $color-back;
  156. }
  157. &:disabled,
  158. &.is-disabled {
  159. color: rgba($color-black, .5);
  160. border-color: rgba($color-black, .3);
  161. &:hover {
  162. background-color: transparent;
  163. }
  164. }
  165. &.is-loading:hover:before {
  166. border-color: rgba($color-text, .25);
  167. border-bottom-color: $color-text;
  168. }
  169. }
  170. &.is-tertiary {
  171. background: none;
  172. color: $color-back;
  173. &:hover {
  174. color: $color-back;
  175. }
  176. &:disabled,
  177. &.is-disabled {
  178. text-decoration: none;
  179. color: rgba($color-black, .5);
  180. }
  181. }
  182. &.is-secondary,
  183. &.is-tertiary {
  184. &.is-loading:before {
  185. border-color: rgba($color-back, 0.25);
  186. border-bottom-color: $color-back;
  187. }
  188. }
  189. }
  190. @mixin make-label($color) {
  191. background-color: rgba($color, .07);
  192. color: $color;
  193. &.is-secondary {
  194. background-color: transparent;
  195. color: $color;
  196. border-color: rgba($color, .3);
  197. }
  198. &.is-tertiary {
  199. background-color: transparent;
  200. color: $color;
  201. }
  202. & .close:hover {
  203. background-color: $color;
  204. }
  205. }
  206. // Clearfix
  207. @mixin clearfix() {
  208. &:after {
  209. content: '';
  210. display: table;
  211. clear: both;
  212. }
  213. }
  214. // Cropline
  215. @mixin cropline($line-height: 1.5, $lheight: $letter-height, $ctop: $crop-top, $cbottom: $crop-bottom) {
  216. &::before,
  217. &::after {
  218. content: '';
  219. display: block;
  220. height: 0;
  221. width: 0;
  222. }
  223. &::before {
  224. margin-top: calc((#{$lheight} - #{$line-height}) * #{$ctop});
  225. }
  226. &::after {
  227. margin-bottom: calc((#{$lheight} - #{$line-height}) * #{$cbottom});
  228. }
  229. }
  230. // Transition
  231. @mixin transition($transition: all linear .2s) {
  232. -moz-transition: $transition;
  233. transition: $transition;
  234. }
  235. // Transform
  236. @mixin transform($transforms) {
  237. -moz-transform: $transforms;
  238. -ms-transform: $transforms;
  239. -webkit-transform: $transforms;
  240. transform: $transforms;
  241. }
  242. // Blur
  243. @mixin blur($radius) {
  244. -webkit-filter: blur($radius);
  245. -moz-filter: blur($radius);
  246. -ms-filter: blur($radius);
  247. filter: blur($radius);
  248. }
  249. // Striped
  250. @mixin striped($color: rgba(255, 255, 255, .2), $angle: 45deg) {
  251. background-image: -webkit-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  252. background-image: -o-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  253. background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  254. }
  255. // Animation
  256. @mixin animation($animation) {
  257. -webkit-animation: $animation;
  258. -moz-animation: $animation;
  259. animation: $animation;
  260. }
  261. // Retina Images
  262. @mixin retina-background-image($file, $type, $width: auto, $height: auto) {
  263. background-repeat: no-repeat;
  264. background-image: url($file + '.' + $type);
  265. @media
  266. only screen and (-webkit-min-device-pixel-ratio: 2),
  267. only screen and (min--moz-device-pixel-ratio: 2),
  268. only screen and (-o-min-device-pixel-ratio: 2/1),
  269. only screen and (min-device-pixel-ratio: 2),
  270. only screen and (min-resolution: 192dpi),
  271. only screen and (min-resolution: 2dppx) {
  272. background-image: url($file + '-2x.' + $type);
  273. background-size: $width $height;
  274. }
  275. }
  276. // Full Height Footer
  277. @mixin full-height-footer($color: #000) {
  278. box-shadow: 0px 500px 0px 500px $color;
  279. }