_mixins.scss 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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 expand-modal-fullscreen($hasModalHeader: true, $hasModalFooter: true) {
  76. // full-screen modal
  77. width: auto;
  78. max-width: unset !important;
  79. height: calc(100vh - 30px);
  80. margin: 15px !important;
  81. .modal-content {
  82. height: calc(100vh - 30px);
  83. }
  84. // expand .modal-body (with calculating height)
  85. .modal-body {
  86. $modal-header: 54px;
  87. $modal-footer: 46px;
  88. $margin: 0px;
  89. @if $hasModalHeader {
  90. $margin: $margin + $modal-header;
  91. }
  92. @if $hasModalFooter {
  93. $margin: $margin + $modal-footer;
  94. }
  95. height: calc(100% - #{$margin});
  96. }
  97. }
  98. @mixin apply-navigation-transition() {
  99. transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  100. transition-duration: 300ms;
  101. }
  102. @mixin border-vertical($beforeOrAfter, $borderLength, $zIndex: initial, $isBtnGroup: false) {
  103. position: relative;
  104. @if $isBtnGroup {
  105. &:not(:first-child) {
  106. margin-left: 0;
  107. border-left: none;
  108. }
  109. &:not(:last-child) {
  110. border-right: none;
  111. }
  112. }
  113. &:not(:first-child) {
  114. &::#{$beforeOrAfter} {
  115. position: absolute;
  116. top: calc((100% - #{$borderLength}) / 2);
  117. left: 0;
  118. z-index: $zIndex;
  119. width: 100%;
  120. height: $borderLength;
  121. margin-left: -0.5px;
  122. content: '';
  123. border-left: 1px solid transparent;
  124. transition: border-color 0.15s ease-in-out;
  125. }
  126. }
  127. }
  128. @mixin blink-bgcolor($bgcolor) {
  129. @keyframes fadeout {
  130. 100% {
  131. opacity: 0;
  132. }
  133. }
  134. position: relative;
  135. z-index: 1;
  136. &::after {
  137. position: absolute;
  138. top: 15%;
  139. left: 0;
  140. z-index: -1;
  141. width: 100%;
  142. height: 70%;
  143. content: '';
  144. background-color: $bgcolor;
  145. border-radius: 2px;
  146. animation: fadeout 1s ease-in 1.5s forwards;
  147. }
  148. }
  149. @mixin button-svg-icon-variant($background, $hover-background: darken($background, 7.5%), $active-background: darken($background, 10%)) {
  150. svg {
  151. fill: color-yiq($background);
  152. }
  153. @include bs.hover() {
  154. svg {
  155. fill: color-yiq($hover-background);
  156. }
  157. }
  158. &:focus,
  159. &.focus {
  160. svg {
  161. fill: color-yiq($hover-background);
  162. }
  163. }
  164. // Disabled comes first so active can properly restyle
  165. &.disabled,
  166. &:disabled {
  167. svg {
  168. fill: color-yiq($background);
  169. }
  170. }
  171. &:not(:disabled):not(.disabled):active,
  172. &:not(:disabled):not(.disabled).active,
  173. .show > &.dropdown-toggle {
  174. svg {
  175. fill: color-yiq($active-background);
  176. }
  177. }
  178. }
  179. @mixin button-outline-svg-icon-variant($value, $color-hover: $value) {
  180. svg {
  181. fill: $value;
  182. }
  183. @include bs.hover() {
  184. svg {
  185. fill: $color-hover;
  186. }
  187. }
  188. &.disabled,
  189. &:disabled {
  190. svg {
  191. fill: $value;
  192. }
  193. }
  194. &:not(:disabled):not(.disabled):active,
  195. &:not(:disabled):not(.disabled).active,
  196. .show > &.dropdown-toggle {
  197. svg {
  198. fill: $color-hover;
  199. }
  200. }
  201. }