_navbar.scss 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /* ===============================================================================================
  2. File Name: navbar.scss
  3. Description: Contain header navigation bar, vertical main navigation bar and
  4. horiznotal main navigation bar related SCSS.
  5. ----------------------------------------------------------------------------------------------
  6. Item Name: Vuexy - Vuejs, React, Angular, HTML & Laravel Admin Dashboard Template
  7. Author: PIXINVENT
  8. Author URL: http://www.themeforest.net/user/pixinvent
  9. ================================================================================================*/
  10. @function set-navbar-text-color($color) {
  11. @if (lightness($color) > 50) {
  12. @return $white; // Lighter backgorund, return dark color
  13. } @else {
  14. @return $black; // Darker background, return light color
  15. }
  16. }
  17. .header-navbar {
  18. padding: 0px;
  19. min-height: $navbar-height;
  20. font-family: $font-family-monospace;
  21. transition: 300ms ease all, background 0s;
  22. z-index: 997;
  23. &.fixed-top,
  24. &.floating-nav {
  25. left: $menu-expanded-width;
  26. }
  27. // Apply navbar color as per background
  28. &[class*='bg-'] {
  29. .navbar-nav {
  30. .nav-item {
  31. > a {
  32. color: set-navbar-text-color($theme-dark-body-color) !important;
  33. i,
  34. svg,
  35. span {
  36. color: set-navbar-text-color($theme-dark-body-color) !important;
  37. }
  38. }
  39. .dropdown-menu {
  40. i,
  41. svg {
  42. color: inherit !important;
  43. }
  44. }
  45. }
  46. .search-input {
  47. .input,
  48. .search-list .auto-suggestion span {
  49. color: $body-color !important;
  50. }
  51. }
  52. }
  53. }
  54. //* Navbar modifiers
  55. //*------------------------
  56. // floating nav
  57. &.floating-nav {
  58. position: fixed;
  59. top: 0;
  60. right: 0;
  61. margin-top: #{$floating-nav-margin};
  62. width: calc(100vw - (100vw - 100%) - calc(#{$content-padding} * 2) - #{$menu-expanded-width});
  63. border-radius: $card-border-radius;
  64. z-index: 12;
  65. margin-left: auto;
  66. margin-right: auto;
  67. }
  68. // static nav
  69. &.navbar-static-top {
  70. top: 0;
  71. right: 0;
  72. left: $menu-expanded-width;
  73. width: calc(100vw - (100vw - 100%) - #{$sidebar-width});
  74. background: transparent;
  75. box-shadow: none !important; // remove this if removing "menu-shadow" class
  76. }
  77. // add border to navbar
  78. &.navbar-border {
  79. border-bottom: 1px solid $border-color;
  80. }
  81. // add shadow to navbar
  82. &.navbar-shadow {
  83. box-shadow: $box-shadow;
  84. }
  85. &.navbar-dark.navbar-border {
  86. border-bottom: 1px solid $theme-dark-border-color;
  87. }
  88. // Hide navbar dropdown arrow
  89. &:not(.navbar-horizontal) {
  90. .nav-link {
  91. &.dropdown-toggle::after {
  92. display: none;
  93. }
  94. }
  95. }
  96. //* Navbar modifiers
  97. //*------------------------
  98. .navbar-container {
  99. padding: 0.8rem 1rem;
  100. // Added more horizontal padding above small screen
  101. @include media-breakpoint-up(sm) {
  102. padding: 0.8rem 1.4rem;
  103. }
  104. flex-basis: 100%;
  105. transition: 300ms ease all;
  106. margin-left: 0;
  107. // Navbar bookmark primary color on hover
  108. .bookmark-wrapper {
  109. // for bookmark z-index
  110. .bookmark-input {
  111. z-index: 1;
  112. }
  113. }
  114. // Language dd style
  115. .dropdown-language {
  116. .selected-language {
  117. font-weight: 500;
  118. }
  119. .nav-link {
  120. .flag-icon {
  121. margin-right: 0.4rem;
  122. }
  123. }
  124. .dropdown-menu .dropdown-item {
  125. .flag-icon {
  126. margin-right: 0.4rem;
  127. }
  128. }
  129. }
  130. ul.navbar-nav {
  131. li {
  132. line-height: 1.5;
  133. &.dropdown {
  134. .dropdown-menu {
  135. .vertical-layout & {
  136. top: 41px !important; // Apply navbar dd position on vertical layouts only (Not for horizontal layout due to hover out issue)
  137. }
  138. }
  139. }
  140. &.dropdown-language {
  141. .dropdown-menu.dropdown-menu-right {
  142. right: -2px;
  143. }
  144. }
  145. // Cart & Notification badge
  146. &.dropdown-cart,
  147. &.dropdown-notification {
  148. .badge {
  149. &.badge-up {
  150. right: -3px;
  151. }
  152. }
  153. .dropdown-menu.dropdown-menu-right {
  154. right: -2px;
  155. padding: 0;
  156. left: inherit;
  157. &::before {
  158. background: $primary;
  159. border-color: $primary;
  160. }
  161. }
  162. .dropdown-menu-header {
  163. border-top-left-radius: $dropdown-border-radius;
  164. border-top-right-radius: $dropdown-border-radius;
  165. .dropdown-header {
  166. padding: 1.22rem 1.28rem;
  167. }
  168. }
  169. .notification-text {
  170. margin-bottom: 0.5rem;
  171. font-size: smaller;
  172. color: $text-muted;
  173. }
  174. .dropdown-menu-footer {
  175. padding: 1.28rem;
  176. }
  177. }
  178. &.dropdown-notification {
  179. .media-body {
  180. .media-heading {
  181. color: $body-color;
  182. margin-bottom: 0;
  183. line-height: 1.2;
  184. }
  185. }
  186. }
  187. // Cart dropdown
  188. &.dropdown-cart {
  189. .media {
  190. position: relative;
  191. img {
  192. background: $body-bg;
  193. }
  194. &:hover {
  195. .cart-item-remove {
  196. visibility: visible;
  197. }
  198. }
  199. }
  200. .media-heading {
  201. width: 8rem;
  202. h6.cart-item-title {
  203. display: -webkit-box;
  204. -webkit-line-clamp: 2;
  205. -webkit-box-orient: vertical;
  206. overflow: hidden;
  207. }
  208. .cart-item-by {
  209. color: $text-muted;
  210. display: -webkit-box;
  211. -webkit-line-clamp: 1;
  212. -webkit-box-orient: vertical;
  213. overflow: hidden;
  214. }
  215. }
  216. .media-body {
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. }
  221. .cart-item-price {
  222. margin-bottom: 0;
  223. width: 5rem;
  224. text-align: right;
  225. }
  226. .cart-item-remove {
  227. position: absolute;
  228. top: 10px;
  229. right: 17px;
  230. width: 14px;
  231. height: 14px;
  232. cursor: pointer;
  233. @include media-breakpoint-up(md) {
  234. visibility: hidden;
  235. }
  236. }
  237. }
  238. > a.nav-link {
  239. color: $body-color;
  240. padding: 0 0.5rem;
  241. position: relative;
  242. }
  243. &.dropdown-user {
  244. line-height: 1 !important; // Set due to custom 2 line component in navbar
  245. .dropdown-menu {
  246. width: 12rem;
  247. margin-top: 10px;
  248. i,
  249. svg {
  250. height: 16px;
  251. width: 16px;
  252. font-size: 16px;
  253. vertical-align: top;
  254. }
  255. }
  256. }
  257. // Logged in user dropdown styles
  258. a.dropdown-user-link {
  259. display: flex;
  260. align-items: center;
  261. .user-name {
  262. display: inline-block;
  263. margin-bottom: 0.435rem;
  264. margin-left: 0.2rem;
  265. }
  266. .user-status {
  267. font-size: smaller;
  268. }
  269. img {
  270. box-shadow: 0 4px 8px 0 rgba($black, 0.12), 0 2px 4px 0 rgba($black, 0.08);
  271. }
  272. }
  273. // navbar toggle menu size (display below lg)
  274. a.menu-toggle {
  275. i,
  276. svg {
  277. height: 1.6rem;
  278. width: 1.6rem;
  279. font-size: 1.6rem;
  280. }
  281. }
  282. a.dropdown-user-link {
  283. .user-nav {
  284. display: flex;
  285. flex-direction: column;
  286. align-items: flex-end;
  287. float: left;
  288. margin-right: $spacer - 0.2;
  289. }
  290. }
  291. div.input-group {
  292. padding: 0.7rem 1rem;
  293. }
  294. i,
  295. svg {
  296. &.ficon {
  297. height: 1.5rem;
  298. width: 1.5rem;
  299. font-size: 1.5rem;
  300. color: $body-color;
  301. &:hover {
  302. color: $primary;
  303. }
  304. }
  305. }
  306. .media-list {
  307. max-height: 25rem;
  308. }
  309. .scrollable-container {
  310. position: relative;
  311. }
  312. }
  313. }
  314. //Navbar notification css
  315. .dropdown-menu-media {
  316. width: 30rem;
  317. .dropdown-menu-header {
  318. border-bottom: 1px solid $border-color;
  319. }
  320. .media-list {
  321. .media {
  322. padding: 0.9rem 1.28rem;
  323. border: none;
  324. border-bottom: 1px solid $border-color;
  325. &:hover {
  326. background: $body-bg;
  327. }
  328. .media-meta {
  329. color: $body-color;
  330. }
  331. }
  332. a:last-of-type {
  333. .media {
  334. border-bottom: none;
  335. }
  336. }
  337. }
  338. .dropdown-menu-footer {
  339. border-top: 1px solid $border-color;
  340. }
  341. }
  342. }
  343. }
  344. // Navbar shadow on scroll
  345. .header-navbar-shadow {
  346. display: none;
  347. }
  348. // Floating Navbar
  349. .navbar-floating {
  350. // Floating nav should have same padding across all screen
  351. .navbar-container:not(.main-menu-content) {
  352. padding: 0.8rem 1rem;
  353. }
  354. .header-navbar-shadow {
  355. display: block;
  356. background: linear-gradient(
  357. 180deg,
  358. hsla(0, 0%, 97.3%, 0.95) 44%,
  359. hsla(0, 0%, 97.3%, 0.46) 73%,
  360. hsla(0, 0%, 100%, 0)
  361. );
  362. padding-top: 2.2rem;
  363. background-repeat: repeat;
  364. width: 100%;
  365. height: 102px;
  366. position: fixed;
  367. top: 0;
  368. left: 0;
  369. z-index: 11;
  370. }
  371. }
  372. // Navbar colors
  373. .navbar-light {
  374. background: $white;
  375. &.navbar-horizontal {
  376. background: $white;
  377. }
  378. .navbar-nav {
  379. .active {
  380. &.nav-link {
  381. background-color: rgba($black, 0.03);
  382. }
  383. }
  384. .disabled {
  385. &.nav-link {
  386. color: $nav-link-disabled-color;
  387. }
  388. }
  389. }
  390. }
  391. .navbar-dark {
  392. background: $gray-600;
  393. .navbar-brand {
  394. color: $white !important;
  395. }
  396. &.navbar-horizontal {
  397. background: $gray-600;
  398. }
  399. .nav-search {
  400. .form-control,
  401. .btn-secondary {
  402. color: $white;
  403. background: $gray-600;
  404. }
  405. }
  406. .navbar-nav {
  407. li {
  408. line-height: 1;
  409. }
  410. .active {
  411. &.nav-link {
  412. background-color: rgba($white, 0.05);
  413. }
  414. }
  415. .disabled {
  416. &.nav-link {
  417. color: $gray-300;
  418. }
  419. }
  420. }
  421. }
  422. // Media queries for device support
  423. // =========================================
  424. @include media-breakpoint-down(sm) {
  425. .header-navbar {
  426. // generic navbar dropdown specific
  427. .navbar-nav {
  428. .show {
  429. position: static;
  430. }
  431. .open-navbar-container {
  432. padding-top: 0.625rem;
  433. }
  434. }
  435. .navbar-container {
  436. .show {
  437. .dropdown-menu {
  438. right: 0;
  439. left: 0 !important;
  440. float: none;
  441. width: auto !important;
  442. margin-top: 0;
  443. overflow: hidden;
  444. }
  445. }
  446. .dropdown-user {
  447. .dropdown-menu-right {
  448. right: 0 !important;
  449. }
  450. }
  451. ul.navbar-nav {
  452. li {
  453. .dropdown-toggle::after {
  454. margin-right: 0;
  455. margin-left: -2px;
  456. }
  457. }
  458. }
  459. }
  460. }
  461. // dark navbar
  462. .navbar-dark {
  463. .navbar-header {
  464. .navbar-nav {
  465. .nav-link {
  466. color: $white;
  467. }
  468. }
  469. }
  470. .navbar-container {
  471. .navbar-nav {
  472. .nav-link {
  473. color: $gray-600;
  474. }
  475. }
  476. }
  477. }
  478. // light navbar
  479. .navbar-light {
  480. .navbar-header {
  481. .navbar-nav {
  482. .nav-link {
  483. color: $gray-600;
  484. }
  485. }
  486. }
  487. .navbar-container {
  488. .navbar-nav {
  489. .nav-link {
  490. color: $gray-600;
  491. }
  492. }
  493. }
  494. }
  495. }
  496. // For Medium and down: iPad support for navbr
  497. // navbar static top
  498. @include media-breakpoint-down(lg) {
  499. .header-navbar {
  500. // floating nav width
  501. &.floating-nav {
  502. width: calc(100vw - (100vw - 100%) - calc(#{$content-padding} * 2));
  503. }
  504. &.navbar-static-top {
  505. left: 0;
  506. width: 100%;
  507. }
  508. }
  509. }
  510. //For responsive sub nav
  511. @mixin responsive_sub_nav {
  512. .header-navbar {
  513. .navbar-nav {
  514. margin: 0;
  515. flex-flow: row wrap;
  516. .dropdown-menu {
  517. position: absolute;
  518. }
  519. .nav-item {
  520. float: left;
  521. }
  522. }
  523. }
  524. }
  525. @include media-breakpoint-down(md) {
  526. @include responsive_sub_nav;
  527. }
  528. @media (max-width: 767px) {
  529. @include responsive_sub_nav;
  530. }
  531. @include media-breakpoint-down(xs) {
  532. .header-navbar {
  533. &.floating-nav {
  534. width: calc(
  535. 100vw - (100vw - 100%) - calc(#{$content-padding} + 0.4rem)
  536. ) !important; // SM screen calc as per updated spacings
  537. margin-left: calc(#{$content-padding} - 0.8rem);
  538. margin-right: calc(#{$content-padding} - 0.8rem);
  539. }
  540. .navbar-container ul.navbar-nav li .selected-language {
  541. display: none;
  542. }
  543. }
  544. }
  545. /* ----------- iPhone 5, 5S iPhone 6----------- */
  546. // Set dropdown height as per the screen size
  547. @mixin extend_mobile_specific($menu_height) {
  548. .header-navbar {
  549. .navbar-container {
  550. .show {
  551. .dropdown-menu {
  552. max-height: $menu_height;
  553. }
  554. }
  555. }
  556. }
  557. }
  558. /* Landscape */
  559. @media only screen and (min-device-width: 26.78em) and (max-device-width: 47.64em) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) {
  560. @include extend_mobile_specific(180px);
  561. }
  562. /* ----------- iPhone 6+ ----------- */
  563. /* Landscape */
  564. @media only screen and (min-device-width: 29.57em) and (max-device-width: 52.57em) and (-webkit-min-device-pixel-ratio: 3) and (orientation: landscape) {
  565. @include extend_mobile_specific(280px);
  566. }
  567. // for width of navbar in fixed-top
  568. @media (max-width: 1201px) {
  569. .header-navbar {
  570. &.fixed-top,
  571. &.floating-nav {
  572. left: 0;
  573. }
  574. }
  575. .horizontal-layout {
  576. .header-navbar {
  577. .navbar-container {
  578. padding-left: 0.8rem;
  579. padding-right: 0.8rem;
  580. }
  581. }
  582. }
  583. }
  584. @media (max-width: 1199px) {
  585. .header-navbar {
  586. .navbar-container {
  587. ul.navbar-nav li a.dropdown-user-link .user-name {
  588. margin-bottom: 0;
  589. }
  590. }
  591. }
  592. }