utils.scss 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /* ========================================================================
  2. Component: utils
  3. ========================================================================== */
  4. // Utilities classes to simplify
  5. // components constructions
  6. // Extra Background helpers
  7. @function custom-color($key) {
  8. @return map-get($colors, $key);
  9. }
  10. @mixin bgcolor-variant($bgcolor, $text-color: #fff) {
  11. $amountOfLight: 10%;
  12. & {
  13. background-color: custom-color($bgcolor);
  14. color: $text-color !important;
  15. }
  16. &-light {
  17. $col: custom-color($bgcolor + '-light');
  18. background-color: #{$col};
  19. color: $text-color !important;
  20. }
  21. &-dark {
  22. $col: custom-color($bgcolor + '-dark');
  23. background-color: #{$col};
  24. color: $text-color !important;
  25. }
  26. small {
  27. color: inherit;
  28. }
  29. }
  30. @mixin make-bg($bgcolor, $text-color: #fff) {
  31. background-color: $bgcolor;
  32. color: $text-color !important;
  33. }
  34. // Common thumbnail sizes (ideal for images)
  35. @mixin thumnbail-size($sz: 8px) {
  36. width: $sz !important;
  37. height: $sz !important;
  38. }
  39. // Border
  40. // --------------------
  41. .b0 { border-width: 0 !important; }
  42. .bl0 { border-left-width: 0 !important; }
  43. .br0 { border-right-width: 0 !important; }
  44. .bt0 { border-top-width: 0 !important; }
  45. .bb0 { border-bottom-width: 0 !important; }
  46. .br { border-right: 1px solid $border-color;}
  47. .bl { border-left: 1px solid $border-color;}
  48. .bt { border-top: 1px solid $border-color;}
  49. .bb { border-bottom: 0px solid $border-color;}
  50. .b, .ba { @extend .br;@extend .bl;@extend .bt;@extend .bb; } // all borders
  51. // Text helpers
  52. .text-primary { color: $primary !important; }
  53. .text-success { color: $success !important; }
  54. .text-info { color: $info !important; }
  55. .text-warning { color: $warning !important; }
  56. .text-danger { color: $danger !important; }
  57. .text-white { color: #fff !important; }
  58. .text-inverse { color: $inverse !important; }
  59. .text-alpha { color: $text-alpha !important; }
  60. .text-pink { color: $pink !important; }
  61. .text-purple { color: $purple !important; }
  62. .text-dark { color: $dark !important; }
  63. .text-alpha-inverse { color: $text-alpha-inverse !important; }
  64. .text-green { color: $green !important; }
  65. .text-yellow { color: $yellow !important; }
  66. .text-gray-darker { color: $gray-darker !important; }
  67. .text-gray-dark { color: $gray-dark !important; }
  68. .text-gray { color: $gray !important; }
  69. .text-gray-light { color: $gray-light !important; }
  70. .text-gray-lighter { color: $gray-lighter !important; }
  71. .text-inherit { color: inherit !important; }
  72. // Text sizing
  73. .text-sm { font-size: $text-sm; }
  74. .text-md { font-size: $text-md; }
  75. .text-lg { font-size: $text-lg; }
  76. // Text others
  77. .text-nowrap { white-space: nowrap; }
  78. .text-thin { font-weight: 100 !important; }
  79. .text-normal { font-weight: normal !important; }
  80. .text-bold { font-weight: bold !important; }
  81. .inline { display: inline-block !important; }
  82. .block-center { margin: 0 auto; }
  83. // Background helpers
  84. .bg-primary { @include bgcolor-variant('primary'); }
  85. .bg-success { @include bgcolor-variant('success'); }
  86. .bg-info { @include bgcolor-variant('info'); }
  87. .bg-warning { @include bgcolor-variant('warning'); }
  88. .bg-danger { @include bgcolor-variant('danger'); }
  89. .bg-green { @include bgcolor-variant('green'); }
  90. .bg-pink { @include bgcolor-variant('pink'); }
  91. .bg-purple { @include bgcolor-variant('purple'); }
  92. .bg-inverse { @include bgcolor-variant('inverse'); }
  93. .bg-yellow { @include bgcolor-variant('yellow'); }
  94. .bg-white { @include make-bg(#fff, inherit); }
  95. .bg-gray-darker { @include make-bg($gray-darker); }
  96. .bg-gray-dark { @include make-bg($gray-dark); }
  97. .bg-gray { @include make-bg($gray, $body-color); }
  98. .bg-gray-light { @include make-bg($gray-light, $body-color); }
  99. .bg-gray-lighter { @include make-bg($gray-lighter, $body-color); }
  100. .bg-transparent { background-color: transparent !important; }
  101. .bg-cover {
  102. background-size: cover;
  103. }
  104. // Common thumbnail sizes (ideal for images)
  105. .thumb8 { @include thumnbail-size(); }
  106. .thumb16 { @include thumnbail-size(16px); }
  107. .thumb24 { @include thumnbail-size(24px); }
  108. .thumb32 { @include thumnbail-size(32px); }
  109. .thumb48 { @include thumnbail-size(48px); }
  110. .thumb64 { @include thumnbail-size(64px); }
  111. .thumb80 { @include thumnbail-size(80px); }
  112. .thumb96 { @include thumnbail-size(96px); }
  113. .thumb128 { @include thumnbail-size(128px); }
  114. // Vertical align helpers
  115. .align-middle {
  116. vertical-align: middle;
  117. }
  118. .align-top {
  119. vertical-align: top;
  120. }
  121. .align-bottom {
  122. vertical-align: bottom;
  123. }
  124. // Background image
  125. .bg-center {
  126. background-position: center center;
  127. background-size: cover;
  128. }
  129. // List
  130. .list-icon {
  131. em {
  132. font-size: 14px;
  133. width: 40px;
  134. vertical-align: middle;
  135. margin: 0;
  136. display: inline-block;
  137. text-align: center;
  138. @include transition(all .2s);
  139. line-height: 30px;
  140. }
  141. div:hover em {
  142. transform: scale(3, 3)
  143. }
  144. }
  145. // Fixed table layout algorithm
  146. .d-table-fixed {
  147. table-layout: fixed;
  148. }
  149. // Components size
  150. .wd-xxs { width: $wd-xxs; }
  151. .wd-xs { width: $wd-xs; }
  152. .wd-sm { width: $wd-sm; }
  153. .wd-sd { width: $wd-sd; }
  154. .wd-md { width: $wd-md; }
  155. .wd-lg { width: $wd-lg; }
  156. .wd-xl { width: $wd-xl; }
  157. .wd-xxl { width: $wd-xxl; }
  158. .wd-wide { width: $wd-wide; }
  159. .wd-auto { width: $wd-auto; }
  160. .wd-zero { width: $wd-zero; }
  161. // Simulate clickable element
  162. .clickable {
  163. cursor: pointer;
  164. }
  165. // Absolute center element
  166. // -----------------------------------
  167. .abs-center-container {
  168. position: relative;
  169. }
  170. .abs-center {
  171. // width: 50%;
  172. height: 50%;
  173. overflow: auto;
  174. margin: auto;
  175. position: absolute;
  176. top: 0; left: 0; bottom: 0; right: 0;
  177. &.abs-fixed {
  178. position: fixed;
  179. z-index: 999;
  180. }
  181. &.abs-right {
  182. left: auto; right: 20px;
  183. text-align: right;
  184. }
  185. &.abs-left {
  186. right: auto; left: 20px;
  187. text-align: left;
  188. }
  189. }
  190. @media (max-height: 720px) {
  191. .abs-center {
  192. position: relative;
  193. }
  194. }
  195. .link-unstyled {
  196. text-decoration: none !important;
  197. outline: none !important;
  198. }
  199. .no-resize {
  200. resize: none;
  201. max-width: 100%;
  202. min-width: 100%;
  203. }
  204. .ie-fix-flex {
  205. -ms-flex: 0 0 auto;
  206. }