_mixins.scss 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // MEDIA
  2. @mixin media-max ($size) {
  3. @media only screen and (max-width: #{$size}px) {
  4. @content
  5. }
  6. }
  7. @mixin media-min ($size) {
  8. @media only screen and (min-width: #{$size}px) {
  9. @content
  10. }
  11. }
  12. @mixin media-min-h ($size) {
  13. @media screen and (min-height: #{$size}px) {
  14. @content
  15. }
  16. }
  17. @mixin media-max-h ($size) {
  18. @media screen and (max-height: #{$size}px) {
  19. @content
  20. }
  21. }
  22. @mixin center {
  23. position: absolute;
  24. top: 50%;
  25. left: 50%;
  26. transform: translate(-50%, -50%);
  27. -webkit-transform: translate(-50%, -50%);
  28. }
  29. @mixin flex($justify: null, $align: null, $flow: null, $gap: null) {
  30. display: flex;
  31. @if $justify {
  32. justify-content: $justify;
  33. }
  34. @if $align {
  35. align-items: $align;
  36. }
  37. @if $flow {
  38. flex-flow: $flow;
  39. }
  40. @if $gap {
  41. gap: $gap;
  42. }
  43. }
  44. @mixin absolute($left: null, $top: null, $right: null, $bottom: null) {
  45. position: absolute;
  46. @if $left {
  47. left: $left;
  48. }
  49. @if $top {
  50. top: $top;
  51. }
  52. @if $right {
  53. right: $right;
  54. }
  55. @if $bottom {
  56. bottom: $bottom;
  57. }
  58. }
  59. @mixin desktop { @media (min-width: 1200px) { @content; } }
  60. @mixin tablet { @media (max-width: 1199px) { @content; } }
  61. @mixin mobile{ @media (max-width: 768px) { @content; } }
  62. @mixin mobile-sm{ @media (max-width: 575px) { @content; } }
  63. @mixin fz($size) {
  64. @if $size == l {
  65. font-size: var(--l);
  66. }
  67. @if $size == m {
  68. font-size: var(--m);
  69. }
  70. @if $size == s {
  71. font-size: var(--s);
  72. }
  73. }
  74. @mixin ai($width, $height) {
  75. &:after {
  76. content:'';
  77. display: block;
  78. padding-bottom: calc($height/$width*100%);
  79. }
  80. }