_mixins.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. .main {
  23. width: 100%;
  24. height: calc(100vh - #{$editor-margin-top});
  25. margin-top: 0px !important;
  26. .grw-container-convertible {
  27. max-width: unset;
  28. padding: 0;
  29. margin: 0;
  30. }
  31. &,
  32. .content-main,
  33. .tab-content {
  34. display: flex;
  35. flex: 1;
  36. flex-direction: column;
  37. .tab-pane {
  38. height: calc(100vh - #{$header-plus-footer});
  39. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  40. }
  41. #page-editor {
  42. // right(preview)
  43. &,
  44. & > .row,
  45. .page-editor-preview-container,
  46. .page-editor-preview-body {
  47. height: calc(100vh - #{$header-plus-footer});
  48. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  49. }
  50. // left(editor)
  51. .page-editor-editor-container {
  52. height: calc(100vh - #{$header-plus-footer});
  53. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  54. .react-codemirror2,
  55. .CodeMirror,
  56. .CodeMirror-scroll,
  57. .textarea-editor {
  58. height: calc(100vh - #{$editor-margin});
  59. }
  60. }
  61. }
  62. #page-editor-with-hackmd {
  63. &,
  64. .hackmd-preinit,
  65. .hackmd-error,
  66. #iframe-hackmd-container > iframe {
  67. width: 100%;
  68. height: calc(100vh - #{$header-plus-footer});
  69. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  70. }
  71. }
  72. }
  73. }
  74. }
  75. @mixin apply-navigation-transition() {
  76. transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  77. transition-duration: 300ms;
  78. }
  79. @mixin border-vertical($beforeOrAfter, $borderLength, $zIndex: initial, $isBtnGroup: false) {
  80. position: relative;
  81. @if $isBtnGroup {
  82. &:not(:first-child) {
  83. margin-left: 0;
  84. border-left: none;
  85. }
  86. &:not(:last-child) {
  87. border-right: none;
  88. }
  89. }
  90. &:not(:first-child) {
  91. &::#{$beforeOrAfter} {
  92. position: absolute;
  93. top: calc((100% - #{$borderLength}) / 2);
  94. left: 0;
  95. z-index: $zIndex;
  96. width: 100%;
  97. height: $borderLength;
  98. margin-left: -0.5px;
  99. content: '';
  100. border-left: 1px solid transparent;
  101. transition: border-color 0.15s ease-in-out;
  102. }
  103. }
  104. }
  105. @mixin blink-bgcolor($bgcolor) {
  106. @keyframes fadeout {
  107. 100% {
  108. opacity: 0;
  109. }
  110. }
  111. position: relative;
  112. z-index: 1;
  113. &::after {
  114. position: absolute;
  115. top: 15%;
  116. left: 0;
  117. z-index: -1;
  118. width: 100%;
  119. height: 70%;
  120. content: '';
  121. background-color: $bgcolor;
  122. border-radius: 2px;
  123. animation: fadeout 1s ease-in 1.5s forwards;
  124. }
  125. }
  126. @mixin button-svg-icon-variant($background, $hover-background: darken($background, 7.5%), $active-background: darken($background, 10%)) {
  127. svg {
  128. fill: color-yiq($background);
  129. }
  130. @include bs.hover() {
  131. svg {
  132. fill: color-yiq($hover-background);
  133. }
  134. }
  135. &:focus,
  136. &.focus {
  137. svg {
  138. fill: color-yiq($hover-background);
  139. }
  140. }
  141. // Disabled comes first so active can properly restyle
  142. &.disabled,
  143. &:disabled {
  144. svg {
  145. fill: color-yiq($background);
  146. }
  147. }
  148. &:not(:disabled):not(.disabled):active,
  149. &:not(:disabled):not(.disabled).active,
  150. .show > &.dropdown-toggle {
  151. svg {
  152. fill: color-yiq($active-background);
  153. }
  154. }
  155. }
  156. @mixin button-outline-svg-icon-variant($value, $color-hover: $value) {
  157. svg {
  158. fill: $value;
  159. }
  160. @include bs.hover() {
  161. svg {
  162. fill: $color-hover;
  163. }
  164. }
  165. &.disabled,
  166. &:disabled {
  167. svg {
  168. fill: $value;
  169. }
  170. }
  171. &:not(:disabled):not(.disabled):active,
  172. &:not(:disabled):not(.disabled).active,
  173. .show > &.dropdown-toggle {
  174. svg {
  175. fill: $color-hover;
  176. }
  177. }
  178. }