main-menu-mixin.scss 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. // =========================================================================================
  2. // File Name: main-menu-mixin.scss
  3. // Description: Common mixin for menus, contain dark and light version scss.
  4. // ----------------------------------------------------------------------------------------
  5. // Item Name: Vuexy - Vuejs, React, Angular, HTML & Laravel Admin Dashboard Template
  6. // Author: PIXINVENT
  7. // Author URL: http://www.themeforest.net/user/pixinvent
  8. //==========================================================================================
  9. // Header navbar content and brand expanded & collapsed stats
  10. // spacing and sizing.
  11. // ================================================
  12. // Mixins for the menu and navbar position, margin and width change
  13. @mixin main-menu-width($menu-width) {
  14. margin-left: $menu-width;
  15. }
  16. @mixin menu-navbar-width($menu-width) {
  17. float: left;
  18. width: $menu-width;
  19. }
  20. // Mixins for the menu show hide based on width
  21. @mixin vertical-menu-transform-show($transform-width) {
  22. transform: translate3d($transform-width, 0, 0);
  23. backface-visibility: hidden;
  24. perspective: 1000;
  25. }
  26. @mixin vertical-menu-transform-hide() {
  27. transform: translate3d(0, 0, 0);
  28. }
  29. // Mixins for the sub menu arrow
  30. @mixin vertical-menu-has-sub-arrow($arrow-font-size) {
  31. &.has-sub {
  32. > a:after {
  33. content: '';
  34. background-image: url(str-replace(str-replace($chevron-right, 'currentColor', $body-color), '#', '%23'));
  35. background-repeat: no-repeat;
  36. background-position: center;
  37. background-size: $arrow-font-size;
  38. height: $arrow-font-size;
  39. width: $arrow-font-size;
  40. display: inline-block;
  41. position: absolute;
  42. right: 20px;
  43. top: 14px;
  44. transform: rotate(0deg);
  45. transition: all 0.2s ease-out;
  46. }
  47. &.open:not(.menu-item-closing) {
  48. > a:after {
  49. transform: rotate(90deg);
  50. }
  51. }
  52. }
  53. }
  54. // Used for apps
  55. @mixin content-area-wrapper-height(
  56. $contentPadding: 0rem,
  57. $navbarHeight: 0rem,
  58. $footerHeight: 0rem,
  59. $floatingNavMargin: 0rem,
  60. $horizontalMenuHeight: 0rem,
  61. $spacingSides: 1,
  62. $horizontalLayout: false
  63. ) {
  64. height: calc(
  65. 100vh -
  66. calc(
  67. calc(#{$contentPadding} * #{$spacingSides}) + #{$navbarHeight} + #{$footerHeight} + #{$floatingNavMargin} + #{$horizontalMenuHeight}
  68. )
  69. );
  70. height: calc(
  71. var(--vh, 1vh) * 100 -
  72. calc(
  73. calc(#{$contentPadding} * #{$spacingSides}) + #{$navbarHeight} + #{$footerHeight} + #{$floatingNavMargin} + #{$horizontalMenuHeight}
  74. )
  75. );
  76. // responsive size height
  77. @if $horizontalLayout {
  78. @include media-breakpoint-down(lg) {
  79. height: calc(
  80. 100vh - calc(calc(calc(#{$contentPadding} - 0.8rem) * #{$spacingSides}) + #{$navbarHeight} + #{$footerHeight})
  81. );
  82. height: calc(
  83. var(--vh, 1vh) * 100 -
  84. calc(calc(calc(#{$contentPadding} - 0.8rem) * #{$spacingSides}) + #{$navbarHeight} + #{$footerHeight})
  85. );
  86. }
  87. } @else {
  88. @include media-breakpoint-down(xs) {
  89. height: calc(
  90. 100vh -
  91. calc(
  92. calc(calc(#{$contentPadding} * #{$spacingSides}) - calc(0.8rem * #{$spacingSides})) + #{$navbarHeight} + #{$footerHeight} +
  93. #{$floatingNavMargin} + #{$horizontalMenuHeight}
  94. )
  95. );
  96. height: calc(
  97. var(--vh, 1vh) * 100 -
  98. calc(
  99. calc(calc(#{$contentPadding} * #{$spacingSides}) - calc(0.8rem * #{$spacingSides})) + #{$navbarHeight} + #{$footerHeight} +
  100. #{$floatingNavMargin} + #{$horizontalMenuHeight}
  101. )
  102. );
  103. }
  104. }
  105. }
  106. // Light & Dark menu mixin
  107. // $theme-color : Menu text color
  108. // $theme-bg : Menu background color
  109. // ================================================
  110. @mixin menu-theme($theme-color, $theme-bg) {
  111. $main-menu-top-open-color: darken($theme-color, 10%);
  112. $main-menu-top-open-hover-bg: darken($theme-bg, 6%);
  113. $main-menu-top-open-head-bg: darken($theme-bg, 4%);
  114. $main-menu-top-active-head-bg: darken($theme-bg, 4%); //$primary
  115. $main-menu-sub-color: $theme-color;
  116. $main-menu-sub-hover-color: lighten($theme-color, 4%);
  117. $main-menu-sub-open-color: $theme-color;
  118. color: $theme-color;
  119. background: $theme-bg;
  120. .navigation {
  121. background: $theme-bg;
  122. .navigation-header {
  123. color: lighten($theme-color, 21.5%);
  124. margin: calc(#{$content-padding} + 0.286rem) 0 0.8rem ($content-padding + 0.2rem);
  125. padding: 0;
  126. line-height: 1.5;
  127. letter-spacing: 0.01rem;
  128. span {
  129. font-weight: 500;
  130. }
  131. }
  132. li {
  133. &.has-sub {
  134. > a {
  135. transition: all 0.5s ease, background 0s, color 0s;
  136. }
  137. }
  138. a {
  139. color: darken($theme-color, 4.9%);
  140. padding: $menu-padding;
  141. line-height: 1.45;
  142. span.menu-sub-title {
  143. color: lighten($theme-color, 30%);
  144. }
  145. & > * {
  146. transition: transform 0.25s ease;
  147. }
  148. }
  149. }
  150. // Menu Item Hover Animation
  151. li.nav-item {
  152. a:hover > * {
  153. transition: transform 0.25s ease;
  154. transform: translateX(5px);
  155. }
  156. ul.menu-content {
  157. li {
  158. a:hover > * {
  159. transition: transform 0.25s ease;
  160. transform: translateX(5px);
  161. }
  162. }
  163. }
  164. }
  165. > li {
  166. > a {
  167. margin: 0 15px;
  168. .label {
  169. margin-top: 4px;
  170. margin-right: 5px;
  171. }
  172. i,
  173. svg {
  174. position: relative;
  175. top: 1px;
  176. }
  177. }
  178. > ul li {
  179. &:first-of-type {
  180. margin-top: 7px !important;
  181. }
  182. &:not(.has-sub) {
  183. margin: 0 15px;
  184. }
  185. &.has-sub {
  186. > a {
  187. margin: 0 15px;
  188. }
  189. > ul > li {
  190. margin: 0 15px;
  191. }
  192. }
  193. }
  194. &.open:not(.menu-item-closing),
  195. &.sidebar-group-active {
  196. > a {
  197. color: $main-menu-top-open-color;
  198. background: $main-menu-top-open-head-bg;
  199. border-radius: 6px;
  200. }
  201. }
  202. &:not(.open) {
  203. > ul {
  204. display: none;
  205. .active {
  206. background: transparent;
  207. box-shadow: none;
  208. }
  209. }
  210. }
  211. &.active {
  212. z-index: 1;
  213. > a {
  214. background: linear-gradient(118deg, rgba($primary, 1), rgba($primary, 0.7));
  215. box-shadow: 0 0 10px 1px rgba($primary, 0.7);
  216. color: $white;
  217. font-weight: 400;
  218. border-radius: 4px;
  219. }
  220. }
  221. .active {
  222. background: $main-menu-top-open-hover-bg;
  223. > a {
  224. color: $primary;
  225. margin-bottom: 0;
  226. }
  227. .hover,
  228. :hover {
  229. > a {
  230. background: $main-menu-top-active-head-bg;
  231. }
  232. }
  233. }
  234. ul {
  235. padding: 0;
  236. margin: 0;
  237. li {
  238. color: $main-menu-sub-color;
  239. background: transparent;
  240. > a {
  241. padding: $menu-second-level-padding;
  242. }
  243. ul {
  244. a {
  245. padding: $menu-third-level-padding;
  246. }
  247. }
  248. }
  249. .has-sub {
  250. &:not(.open) {
  251. > ul {
  252. display: none;
  253. .active {
  254. background: transparent;
  255. box-shadow: none;
  256. }
  257. }
  258. }
  259. }
  260. .open,
  261. .sidebar-group-active {
  262. > a {
  263. color: $main-menu-sub-open-color;
  264. background: $main-menu-top-active-head-bg;
  265. border-radius: 6px;
  266. }
  267. //for 2rd level menu
  268. > ul {
  269. display: block;
  270. //for 3rd level menu
  271. .open {
  272. > ul {
  273. display: block;
  274. }
  275. }
  276. }
  277. }
  278. .hover,
  279. &:hover {
  280. > a {
  281. color: $main-menu-sub-hover-color;
  282. }
  283. }
  284. .active {
  285. background: linear-gradient(118deg, rgba($primary, 1), rgba($primary, 0.7));
  286. box-shadow: 0 0 10px 1px rgba($primary, 0.7);
  287. border-radius: 4px;
  288. z-index: 1;
  289. > a {
  290. color: $white;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. // Menu content display mixin
  298. // $menu-expanded-width : Expanded menu width
  299. // $menu-collapsed-width: Collapsed menu width
  300. // ================================================
  301. @mixin menu-content($menu-expanded-width, $menu-collapsed-width, $theme-color, $theme-bg) {
  302. .main-menu-content {
  303. > span.menu-title,
  304. a.menu-title {
  305. right: -($menu-expanded-width);
  306. width: $menu-expanded-width;
  307. font-weight: 600;
  308. color: #fff;
  309. text-transform: uppercase;
  310. text-align: left;
  311. background-color: $primary;
  312. border-color: $primary;
  313. padding: 13px 20px;
  314. }
  315. > ul.menu-content {
  316. left: $menu-collapsed-width;
  317. width: $menu-expanded-width;
  318. transition: visibility 0.25s, opacity 0.25s;
  319. box-shadow: 1px 0px 2px rgba($black, 0.1);
  320. border-bottom: 2px solid rgba($black, 0.2);
  321. border-left: 1px solid rgba($black, 0.02);
  322. li {
  323. white-space: nowrap;
  324. position: relative;
  325. a {
  326. display: block;
  327. padding: 8px 20px 8px 20px;
  328. }
  329. @include vertical-menu-has-sub-arrow(1rem);
  330. }
  331. }
  332. }
  333. }