_sidebar.scss 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. }
  26. // When the sidebar is collapsed...
  27. &.sidebar-collapse {
  28. .d-hidden-mini {
  29. display: none;
  30. }
  31. // Apply the new margins to the main content and footer
  32. .content-wrapper,
  33. .main-footer,
  34. .main-header {
  35. margin-left: $sidebar-mini-width !important;
  36. }
  37. // Make the sidebar headers
  38. .nav-sidebar .nav-header {
  39. display: none;
  40. }
  41. .sidebar .nav-sidebar .nav-link p {
  42. width: 0;
  43. white-space: nowrap;
  44. }
  45. .sidebar .user-panel > .info,
  46. .sidebar .nav-sidebar .nav-link p,
  47. .brand-text {
  48. margin-left: -10px;
  49. animation-name: fade-out;
  50. animation-duration: $transition-speed;
  51. animation-fill-mode: both;
  52. visibility: hidden;
  53. }
  54. .logo-xl {
  55. animation-name: fade-out;
  56. animation-duration: $transition-speed;
  57. animation-fill-mode: both;
  58. visibility: hidden;
  59. }
  60. .logo-xs {
  61. display: inline-block;
  62. animation-name: fade-in;
  63. animation-duration: $transition-speed;
  64. animation-fill-mode: both;
  65. visibility: visible;
  66. }
  67. // Modify the sidebar to shrink instead of disappearing
  68. .main-sidebar {
  69. overflow-x: hidden;
  70. &,
  71. &::before {
  72. // Don't go away! Just shrink
  73. margin-left: 0;
  74. width: $sidebar-mini-width;
  75. }
  76. .user-panel {
  77. .image {
  78. float: none;
  79. }
  80. }
  81. &:not(.sidebar-no-expand) {
  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. .sidebar .nav-sidebar .nav-link p,
  96. .brand-text,
  97. .logo-xl {
  98. display: inline-block;
  99. margin-left: 0;
  100. animation-name: fade-in;
  101. animation-duration: $transition-speed;
  102. animation-fill-mode: both;
  103. visibility: visible;
  104. }
  105. .logo-xs {
  106. animation-name: fade-out;
  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. }
  127. // Make an element visible only when sidebar mini is active
  128. .visible-sidebar-mini {
  129. display: block !important;
  130. }
  131. &.layout-fixed {
  132. .main-sidebar:hover {
  133. .brand-link {
  134. width: $sidebar-width;
  135. }
  136. }
  137. .brand-link {
  138. width: $sidebar-mini-width;
  139. }
  140. }
  141. }
  142. }