_mixins.scss 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. @mixin variable-font-size($basesize) {
  2. font-size: $basesize * 0.6;
  3. @include media-breakpoint-only(sm) {
  4. font-size: #{$basesize * 0.7};
  5. }
  6. @include media-breakpoint-only(md) {
  7. font-size: #{$basesize * 0.8};
  8. }
  9. @include media-breakpoint-only(lg) {
  10. font-size: #{$basesize * 0.9};
  11. }
  12. @include media-breakpoint-only(xl) {
  13. font-size: $basesize;
  14. }
  15. }
  16. @mixin expand-editor($editor-header-plus-footer, $navbar-height-adjustment: 0px) {
  17. $navbar-height: $grw-navbar-border-width + $navbar-height-adjustment;
  18. $header-plus-footer: $navbar-height + $editor-header-plus-footer + 2px; // add .main padding-top
  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 - #{$navbar-height});
  25. padding-top: 2px;
  26. margin-top: 0px !important;
  27. &,
  28. .content-main,
  29. .tab-content {
  30. display: flex;
  31. flex: 1;
  32. flex-direction: column;
  33. #edit,
  34. #hackmd {
  35. height: calc(100vh - #{$header-plus-footer});
  36. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  37. }
  38. #page-editor {
  39. // right(preview)
  40. &,
  41. & > .row,
  42. .page-editor-preview-container,
  43. .page-editor-preview-body {
  44. height: calc(100vh - #{$header-plus-footer});
  45. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  46. }
  47. // left(editor)
  48. .page-editor-editor-container {
  49. height: calc(100vh - #{$header-plus-footer});
  50. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  51. .react-codemirror2,
  52. .CodeMirror,
  53. .CodeMirror-scroll,
  54. .textarea-editor {
  55. height: calc(100vh - #{$editor-margin});
  56. }
  57. }
  58. }
  59. #page-editor-with-hackmd {
  60. &,
  61. .hackmd-preinit,
  62. .hackmd-error,
  63. #iframe-hackmd-container > iframe {
  64. width: 100%;
  65. height: calc(100vh - #{$header-plus-footer});
  66. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  67. }
  68. }
  69. }
  70. }
  71. }
  72. @mixin expand-modal-fullscreen($hasModalHeader: true, $hasModalFooter: true) {
  73. // full-screen modal
  74. width: auto;
  75. max-width: unset !important;
  76. height: calc(100vh - 30px);
  77. margin: 15px !important;
  78. .modal-content {
  79. height: calc(100vh - 30px);
  80. }
  81. // expand .modal-body (with calculating height)
  82. .modal-body {
  83. $modal-header: 54px;
  84. $modal-footer: 46px;
  85. $margin: 0px;
  86. @if $hasModalHeader {
  87. $margin: $margin + $modal-header;
  88. }
  89. @if $hasModalFooter {
  90. $margin: $margin + $modal-footer;
  91. }
  92. height: calc(100% - #{$margin});
  93. }
  94. }
  95. /*
  96. * see: https://gist.github.com/bjmiller121/902745cbb38d88178882
  97. *
  98. * Makes a CSS hexagon! based off of http://csshexagon.com/
  99. * Demo: http://sassmeister.com/gist/98fcf3ce163a97d2ef7e
  100. */
  101. @mixin hexagonize($size, $color, $box-shadow: 0, $border: 0) {
  102. width: $size;
  103. height: ($size * 0.577);
  104. margin: ($size * 0.288) 0;
  105. background-color: $color;
  106. border-right: $border;
  107. border-left: $border;
  108. @if $box-shadow != 0 {
  109. box-shadow: $box-shadow;
  110. }
  111. &:before,
  112. &:after {
  113. position: absolute;
  114. content: '';
  115. @if $border == 0 and $box-shadow == 0 {
  116. left: 0;
  117. width: 0;
  118. border-right: ($size/2) solid transparent;
  119. border-left: ($size/2) solid transparent;
  120. } @else {
  121. left: ($size * 0.129);
  122. z-index: 1;
  123. width: ($size * 0.707);
  124. height: ($size * 0.707);
  125. background-color: inherit;
  126. transform: scaleY(0.6) rotate(-45deg);
  127. }
  128. @if $box-shadow != 0 {
  129. box-shadow: $box-shadow;
  130. }
  131. }
  132. &:before {
  133. @if $border == 0 and $box-shadow == 0 {
  134. bottom: 99%;
  135. border-bottom: ($size * 0.288) solid $color;
  136. } @else {
  137. top: -($size * 0.353);
  138. }
  139. @if $border != 0 {
  140. border-top: $border;
  141. border-right: $border;
  142. }
  143. }
  144. &:after {
  145. @if $border == 0 and $box-shadow == 0 {
  146. top: 99%;
  147. width: 0;
  148. border-top: ($size * 0.288) solid $color;
  149. } @else {
  150. bottom: -($size * 0.353);
  151. }
  152. @if $border != 0 {
  153. border-bottom: $border;
  154. border-left: $border;
  155. }
  156. }
  157. @if $box-shadow != 0 {
  158. > span {
  159. position: absolute;
  160. top: 0;
  161. left: 0;
  162. z-index: 2;
  163. &:after {
  164. position: absolute;
  165. top: 0;
  166. left: 0;
  167. width: $size;
  168. height: $size * 0.577;
  169. content: '';
  170. background-color: $color;
  171. }
  172. }
  173. }
  174. }
  175. @mixin override-hexagon-color($color, $bgcolor) {
  176. background-color: $bgcolor;
  177. transition: background-color 200ms linear, color 100ms linear, opacity 300ms cubic-bezier(0.2, 0, 0, 1), transform 300ms cubic-bezier(0.2, 0, 0, 1);
  178. &:before {
  179. border-bottom-color: $bgcolor;
  180. transition: border-bottom-color 200ms linear;
  181. }
  182. &:after {
  183. border-top-color: $bgcolor;
  184. transition: border-top-color 200ms linear;
  185. }
  186. > span:after {
  187. background-color: $bgcolor;
  188. transition: background-color 200ms linear;
  189. }
  190. svg path {
  191. fill: $color;
  192. }
  193. }
  194. @mixin apply-navigation-transition() {
  195. transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  196. transition-duration: 300ms;
  197. }