_mixins.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Responsive breakpoints mixin
  2. @mixin add_variables( $view: frontend ) {
  3. @if frontend == $view {
  4. :root {
  5. @content;
  6. }
  7. }
  8. @if editor == $view {
  9. :root, body {
  10. @content;
  11. }
  12. }
  13. }
  14. // Crop Text Boundry
  15. // - Sets a fixed-width on content within alignwide and alignfull blocks
  16. @mixin crop-text($inset-line-height: 1) {
  17. line-height: $inset-line-height;
  18. $offset-top: calc(.5em * #{$inset-line-height} + -.38);
  19. $offset-bottom: calc(.5em * #{$inset-line-height} + -.39);
  20. &:before,
  21. &:after {
  22. content: '';
  23. display: block;
  24. height: 0;
  25. width: 0;
  26. }
  27. &:before {
  28. margin-bottom: -($offset-top);
  29. }
  30. &:after {
  31. margin-top: -($offset-bottom);
  32. }
  33. }
  34. /**
  35. * Required Variables
  36. */
  37. $default_width: 620px;
  38. $alignwide_width: 790px;
  39. $breakpoint_sm: 482px;
  40. $breakpoint_md: 592px;
  41. $breakpoint_lg: 652px;
  42. $breakpoint_xl: 822px;
  43. $breakpoint_xxl: 1024px;
  44. // Responsive breakpoints mixin
  45. @mixin media( $res ) {
  46. @if mobile-only == $res {
  47. @media only screen and (max-width: #{$breakpoint_sm - 1}) {
  48. @content;
  49. }
  50. }
  51. @if mobile == $res {
  52. @media only screen and (min-width: #{$breakpoint_sm}) {
  53. @content;
  54. }
  55. }
  56. @if tablet-only == $res {
  57. @media only screen and (max-width: #{$breakpoint_md - 1}) {
  58. @content;
  59. }
  60. }
  61. @if tablet == $res {
  62. @media only screen and (min-width: #{$breakpoint_md}) {
  63. @content;
  64. }
  65. }
  66. @if laptop-only == $res {
  67. @media only screen and (max-width: #{$breakpoint_lg - 1}) {
  68. @content;
  69. }
  70. }
  71. @if laptop == $res {
  72. @media only screen and (min-width: #{$breakpoint_lg}) {
  73. @content;
  74. }
  75. }
  76. @if desktop-only == $res {
  77. @media only screen and (max-width: #{$breakpoint_xl - 1}) {
  78. @content;
  79. }
  80. }
  81. @if desktop == $res {
  82. @media only screen and (min-width: #{$breakpoint_xl}) {
  83. @content;
  84. }
  85. }
  86. @if wide-only == $res {
  87. @media only screen and (max-width: #{$breakpoint_xxl - 1}) {
  88. @content;
  89. }
  90. }
  91. @if wide == $res {
  92. @media only screen and (min-width: #{$breakpoint_xxl}) {
  93. @content;
  94. }
  95. }
  96. }