_mixins.scss 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. @use './bootstrap/init' as bs;
  2. @mixin variable-font-size($basesize) {
  3. font-size: $basesize * 0.6;
  4. @include bs.media-breakpoint-only(sm) {
  5. font-size: #{$basesize * 0.7};
  6. }
  7. @include bs.media-breakpoint-only(md) {
  8. font-size: #{$basesize * 0.8};
  9. }
  10. @include bs.media-breakpoint-only(lg) {
  11. font-size: #{$basesize * 0.9};
  12. }
  13. @include bs.media-breakpoint-up(xl) {
  14. font-size: $basesize;
  15. }
  16. }
  17. @mixin expand-editor($editor-margin-top) {
  18. $header-plus-footer: $editor-margin-top + $grw-editor-navbar-bottom-height;
  19. $editor-margin: $header-plus-footer //
  20. + 25px // add .btn-open-dropzone height
  21. + 30px; // add .navbar-editor height
  22. .editor-root {
  23. width: 100%;
  24. height: calc(100vh - #{$header-plus-footer});
  25. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  26. margin-top: 0px !important;
  27. // left(editor)
  28. .page-editor-editor-container {
  29. height: calc(100vh - #{$header-plus-footer});
  30. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  31. .react-codemirror2,
  32. .CodeMirror,
  33. .CodeMirror-scroll,
  34. .textarea-editor {
  35. height: calc(100vh - #{$editor-margin});
  36. }
  37. }
  38. // right(preview)
  39. .page-editor-preview-container,
  40. .page-editor-preview-body {
  41. height: calc(100vh - #{$header-plus-footer});
  42. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  43. }
  44. }
  45. .editor-root#page-editor-with-hackmd {
  46. &,
  47. .hackmd-preinit,
  48. .hackmd-error,
  49. #iframe-hackmd-container > iframe {
  50. width: 100%;
  51. height: calc(100vh - #{$header-plus-footer});
  52. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  53. }
  54. }
  55. }
  56. @mixin apply-navigation-transition() {
  57. transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  58. transition-duration: 300ms;
  59. }
  60. @mixin border-vertical($beforeOrAfter, $borderLength, $zIndex: initial, $isBtnGroup: false) {
  61. position: relative;
  62. @if $isBtnGroup {
  63. &:not(:first-child) {
  64. margin-left: 0;
  65. border-left: none;
  66. }
  67. &:not(:last-child) {
  68. border-right: none;
  69. }
  70. }
  71. &:not(:first-child) {
  72. &::#{$beforeOrAfter} {
  73. position: absolute;
  74. top: calc((100% - #{$borderLength}) / 2);
  75. left: 0;
  76. z-index: $zIndex;
  77. width: 100%;
  78. height: $borderLength;
  79. margin-left: -0.5px;
  80. content: '';
  81. border-left: 1px solid transparent;
  82. transition: border-color 0.15s ease-in-out;
  83. }
  84. }
  85. }
  86. @keyframes fadeout {
  87. 100% {
  88. opacity: 0;
  89. }
  90. }
  91. @mixin blink-bgcolor($bgcolor) {
  92. position: relative;
  93. z-index: 1;
  94. &::after {
  95. position: absolute;
  96. top: 15%;
  97. left: 0;
  98. z-index: -1;
  99. width: 100%;
  100. height: 70%;
  101. content: '';
  102. background-color: $bgcolor;
  103. border-radius: 2px;
  104. animation: fadeout 1s ease-in 1.5s forwards;
  105. }
  106. }
  107. @mixin overlay-processing-style($additionalSelector, $contentFontSize: inherit, $contentPadding: inherit) {
  108. .overlay.#{$additionalSelector} {
  109. background: rgba(255, 255, 255, 0.5);
  110. .overlay-content {
  111. padding: $contentPadding;
  112. font-size: $contentFontSize;
  113. color: bs.$gray-700;
  114. background: rgba(200, 200, 200, 0.5);
  115. }
  116. }
  117. }
  118. @mixin insertSimpleLineIcons($code) {
  119. &:before {
  120. margin-right: 0.2em;
  121. font-family: 'simple-line-icons';
  122. content: $code;
  123. }
  124. }
  125. @mixin grw-skeleton-text($font-size, $line-height) {
  126. height: $line-height;
  127. padding: (($line-height - $font-size) / 2) 0;
  128. }
  129. /*
  130. .example {
  131. @include grw-skeleton-text($font-size:$size, $line-height:$height);
  132. max-width: 100%;
  133. }
  134. */
  135. // values from './bootstrap/override'
  136. @mixin grw-skeleton-h3 {
  137. @include grw-skeleton-text(21px, 30px);
  138. }
  139. @mixin grw-skeleton-h5 {
  140. @include grw-skeleton-text(16px, 18px);
  141. }