_mixins.scss 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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-up(xl) {
  13. font-size: $basesize;
  14. }
  15. }
  16. @mixin expand-editor($editor-margin-top) {
  17. $header-plus-footer: $editor-margin-top + $grw-editor-navbar-bottom-height;
  18. $editor-margin: $header-plus-footer //
  19. + 25px // add .btn-open-dropzone height
  20. + 30px; // add .navbar-editor height
  21. .main {
  22. width: 100%;
  23. height: calc(100vh - #{$editor-margin-top});
  24. margin-top: 0px !important;
  25. .grw-container-convertible {
  26. max-width: unset;
  27. padding: 0;
  28. margin: 0;
  29. }
  30. &,
  31. .content-main,
  32. .tab-content {
  33. display: flex;
  34. flex: 1;
  35. flex-direction: column;
  36. .tab-pane {
  37. height: calc(100vh - #{$header-plus-footer});
  38. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  39. }
  40. #page-editor {
  41. // right(preview)
  42. &,
  43. & > .row,
  44. .page-editor-preview-container,
  45. .page-editor-preview-body {
  46. height: calc(100vh - #{$header-plus-footer});
  47. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  48. }
  49. // left(editor)
  50. .page-editor-editor-container {
  51. height: calc(100vh - #{$header-plus-footer});
  52. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  53. .react-codemirror2,
  54. .CodeMirror,
  55. .CodeMirror-scroll,
  56. .textarea-editor {
  57. height: calc(100vh - #{$editor-margin});
  58. }
  59. }
  60. }
  61. #page-editor-with-hackmd {
  62. &,
  63. .hackmd-preinit,
  64. .hackmd-error,
  65. #iframe-hackmd-container > iframe {
  66. width: 100%;
  67. height: calc(100vh - #{$header-plus-footer});
  68. min-height: calc(100vh - #{$header-plus-footer}); // for IE11
  69. }
  70. }
  71. }
  72. }
  73. }
  74. @mixin expand-modal-fullscreen($hasModalHeader: true, $hasModalFooter: true) {
  75. // full-screen modal
  76. width: auto;
  77. max-width: unset !important;
  78. height: calc(100vh - 30px);
  79. margin: 15px !important;
  80. .modal-content {
  81. height: calc(100vh - 30px);
  82. }
  83. // expand .modal-body (with calculating height)
  84. .modal-body {
  85. $modal-header: 54px;
  86. $modal-footer: 46px;
  87. $margin: 0px;
  88. @if $hasModalHeader {
  89. $margin: $margin + $modal-header;
  90. }
  91. @if $hasModalFooter {
  92. $margin: $margin + $modal-footer;
  93. }
  94. height: calc(100% - #{$margin});
  95. }
  96. }
  97. /*
  98. * see: https://gist.github.com/bjmiller121/902745cbb38d88178882
  99. *
  100. * Makes a CSS hexagon! based off of http://csshexagon.com/
  101. * Demo: http://sassmeister.com/gist/98fcf3ce163a97d2ef7e
  102. */
  103. @mixin hexagonize($size, $color, $box-shadow: 0, $border: 0) {
  104. width: $size;
  105. height: ($size * 0.577);
  106. margin: ($size * 0.288) 0;
  107. background-color: $color;
  108. border-right: $border;
  109. border-left: $border;
  110. @if $box-shadow != 0 {
  111. box-shadow: $box-shadow;
  112. }
  113. &:before,
  114. &:after {
  115. position: absolute;
  116. content: '';
  117. @if $border == 0 and $box-shadow == 0 {
  118. left: 0;
  119. width: 0;
  120. border-right: ($size/2) solid transparent;
  121. border-left: ($size/2) solid transparent;
  122. } @else {
  123. left: ($size * 0.129);
  124. z-index: 1;
  125. width: ($size * 0.707);
  126. height: ($size * 0.707);
  127. background-color: inherit;
  128. transform: scaleY(0.6) rotate(-45deg);
  129. }
  130. @if $box-shadow != 0 {
  131. box-shadow: $box-shadow;
  132. }
  133. }
  134. &:before {
  135. @if $border == 0 and $box-shadow == 0 {
  136. bottom: 99%;
  137. border-bottom: ($size * 0.288) solid $color;
  138. } @else {
  139. top: -($size * 0.353);
  140. }
  141. @if $border != 0 {
  142. border-top: $border;
  143. border-right: $border;
  144. }
  145. }
  146. &:after {
  147. @if $border == 0 and $box-shadow == 0 {
  148. top: 99%;
  149. width: 0;
  150. border-top: ($size * 0.288) solid $color;
  151. } @else {
  152. bottom: -($size * 0.353);
  153. }
  154. @if $border != 0 {
  155. border-bottom: $border;
  156. border-left: $border;
  157. }
  158. }
  159. @if $box-shadow != 0 {
  160. > span {
  161. position: absolute;
  162. top: 0;
  163. left: 0;
  164. z-index: 2;
  165. &:after {
  166. position: absolute;
  167. top: 0;
  168. left: 0;
  169. width: $size;
  170. height: $size * 0.577;
  171. content: '';
  172. background-color: $color;
  173. }
  174. }
  175. }
  176. }
  177. @mixin override-hexagon-color($color, $bgcolor) {
  178. background-color: $bgcolor;
  179. 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);
  180. &:before {
  181. border-bottom-color: $bgcolor;
  182. transition: border-bottom-color 200ms linear;
  183. }
  184. &:after {
  185. border-top-color: $bgcolor;
  186. transition: border-top-color 200ms linear;
  187. }
  188. > span:after {
  189. background-color: $bgcolor;
  190. transition: background-color 200ms linear;
  191. }
  192. svg path {
  193. fill: $color;
  194. }
  195. }
  196. @mixin apply-navigation-transition() {
  197. transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
  198. transition-duration: 300ms;
  199. }
  200. @mixin border-vertical($beforeOrAfter, $borderLength, $zIndex: initial, $isBtnGroup: false) {
  201. position: relative;
  202. @if $isBtnGroup {
  203. &:not(:first-child) {
  204. margin-left: 0;
  205. border-left: none;
  206. }
  207. &:not(:last-child) {
  208. border-right: none;
  209. }
  210. }
  211. &:not(:first-child) {
  212. &::#{$beforeOrAfter} {
  213. position: absolute;
  214. top: calc((100% - #{$borderLength}) / 2);
  215. left: 0;
  216. z-index: $zIndex;
  217. width: 100%;
  218. height: $borderLength;
  219. margin-left: -0.5px;
  220. content: '';
  221. border-left: 1px solid transparent;
  222. transition: border-color 0.15s ease-in-out;
  223. }
  224. }
  225. }
  226. @mixin highlighted($color) {
  227. @keyframes fadeout {
  228. 100% {
  229. opacity: 0;
  230. }
  231. }
  232. position: relative;
  233. z-index: 1;
  234. &::after {
  235. position: absolute;
  236. top: 15%;
  237. left: 0;
  238. z-index: -1;
  239. width: 100%;
  240. height: 70%;
  241. content: '';
  242. background-color: $color;
  243. border-radius: 2px;
  244. animation: fadeout 1s ease-in 1.5s forwards;
  245. }
  246. }