_sidebar.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //
  2. // Mixins: Sidebar
  3. //
  4. // Sidebar Color
  5. @mixin sidebar-color($color) {
  6. .nav-sidebar > .nav-item {
  7. > .nav-link.active {
  8. background-color: $color;
  9. color: color-yiq($color);
  10. }
  11. }
  12. .nav-sidebar.nav-legacy > .nav-item {
  13. > .nav-link.active {
  14. border-color: $color;
  15. }
  16. }
  17. }
  18. // Sidebar Mini Breakpoints
  19. @mixin sidebar-mini-breakpoint() {
  20. // A fix for text overflow while transitioning from sidebar mini to full sidebar
  21. .nav-sidebar,
  22. .nav-sidebar > .nav-header,
  23. .nav-sidebar .nav-link {
  24. white-space: nowrap;
  25. overflow: hidden;
  26. }
  27. // When the sidebar is collapsed...
  28. &.sidebar-collapse {
  29. .d-hidden-mini {
  30. display: none;
  31. }
  32. // Apply the new margins to the main content and footer
  33. .content-wrapper,
  34. .main-footer,
  35. .main-header {
  36. margin-left: $sidebar-mini-width !important;
  37. }
  38. // Make the sidebar headers
  39. .nav-sidebar .nav-header {
  40. display: none;
  41. }
  42. .nav-sidebar .nav-link p {
  43. width: 0;
  44. white-space: nowrap;
  45. }
  46. .sidebar .user-panel > .info,
  47. .nav-sidebar .nav-link p,
  48. .brand-text {
  49. margin-left: -10px;
  50. animation-name: fadeOut;
  51. animation-duration: $transition-speed;
  52. animation-fill-mode: both;
  53. visibility: hidden;
  54. }
  55. .logo-xl {
  56. animation-name: fadeOut;
  57. animation-duration: $transition-speed;
  58. animation-fill-mode: both;
  59. visibility: hidden;
  60. }
  61. .logo-xs {
  62. display: inline-block;
  63. animation-name: fadeIn;
  64. animation-duration: $transition-speed;
  65. animation-fill-mode: both;
  66. visibility: visible;
  67. }
  68. // Modify the sidebar to shrink instead of disappearing
  69. .main-sidebar {
  70. overflow-x: hidden;
  71. &,
  72. &::before {
  73. // Don't go away! Just shrink
  74. margin-left: 0;
  75. width: $sidebar-mini-width;
  76. }
  77. .user-panel {
  78. .image {
  79. float: none;
  80. }
  81. }
  82. &:hover,
  83. &.sidebar-focused {
  84. width: $sidebar-width;
  85. .brand-link {
  86. width: $sidebar-width;
  87. }
  88. .user-panel {
  89. text-align: left;
  90. .image {
  91. float: left;
  92. }
  93. }
  94. .user-panel > .info,
  95. .nav-sidebar .nav-link p,
  96. .brand-text,
  97. .logo-xl {
  98. display: inline-block;
  99. margin-left: 0;
  100. animation-name: fadeIn;
  101. animation-duration: $transition-speed;
  102. animation-fill-mode: both;
  103. visibility: visible;
  104. }
  105. .logo-xs {
  106. animation-name: fadeOut;
  107. animation-duration: $transition-speed;
  108. animation-fill-mode: both;
  109. visibility: hidden;
  110. }
  111. .brand-image {
  112. margin-right: .5rem;
  113. }
  114. // Make the sidebar links, menus, labels, badges
  115. // and angle icons disappear
  116. .sidebar-form,
  117. .user-panel > .info {
  118. display: block !important;
  119. transform: translateZ(0);
  120. }
  121. .nav-sidebar > .nav-item > .nav-link > span {
  122. display: inline-block !important;
  123. }
  124. }
  125. }
  126. // Make an element visible only when sidebar mini is active
  127. .visible-sidebar-mini {
  128. display: block !important;
  129. }
  130. &.layout-fixed {
  131. .main-sidebar:hover {
  132. .brand-link {
  133. width: $sidebar-width;
  134. }
  135. }
  136. .brand-link {
  137. width: $sidebar-mini-width;
  138. }
  139. }
  140. }
  141. }