_sidebar-mini.scss 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * Component: Sidebar Mini
  3. * -----------------------
  4. */
  5. // Mixin
  6. @mixin sidebar-mini-breakpoint() {
  7. // A fix for text overflow while transitioning from sidebar mini to full sidebar
  8. .nav-sidebar,
  9. .nav-sidebar > .nav-header,
  10. .nav-sidebar .nav-link {
  11. white-space: nowrap;
  12. overflow: hidden;
  13. }
  14. // When the sidebar is collapsed...
  15. &.sidebar-collapse {
  16. .d-hidden-mini {
  17. display: none;
  18. }
  19. // Apply the new margins to the main content and footer
  20. .content-wrapper,
  21. .main-footer,
  22. .main-header {
  23. margin-left: $sidebar-mini-width !important;
  24. }
  25. // Make the sidebar headers
  26. .nav-sidebar .nav-header {
  27. display: none;
  28. }
  29. .nav-sidebar .nav-link p {
  30. width: 0;
  31. }
  32. .sidebar .user-panel > .info,
  33. .nav-sidebar .nav-link p,
  34. .brand-text {
  35. margin-left: -10px;
  36. opacity: 0;
  37. visibility: hidden;
  38. }
  39. .logo-xl {
  40. opacity: 0;
  41. visibility: hidden;
  42. }
  43. .logo-xs {
  44. display: inline-block;
  45. opacity: 1;
  46. visibility: visible;
  47. }
  48. // Modify the sidebar to shrink instead of disappearing
  49. .main-sidebar {
  50. overflow-x: hidden;
  51. &,
  52. &::before {
  53. // Don't go away! Just shrink
  54. margin-left: 0;
  55. width: $sidebar-mini-width;
  56. }
  57. .user-panel {
  58. .image {
  59. float: none;
  60. }
  61. }
  62. &:hover,
  63. &.sidebar-focused {
  64. width: $sidebar-width;
  65. .user-panel {
  66. text-align: left;
  67. .image {
  68. float: left;
  69. }
  70. }
  71. .user-panel > .info,
  72. .nav-sidebar .nav-link p,
  73. .brand-text,
  74. .logo-xl {
  75. display: inline-block;
  76. margin-left: 0;
  77. opacity: 1;
  78. visibility: visible;
  79. }
  80. .logo-xs {
  81. opacity: 0;
  82. visibility: hidden;
  83. }
  84. .brand-image {
  85. margin-right: .5rem;
  86. }
  87. // Make the sidebar links, menus, labels, badges
  88. // and angle icons disappear
  89. .sidebar-form,
  90. .user-panel > .info {
  91. display: block !important;
  92. -webkit-transform: translateZ(0);
  93. }
  94. .nav-sidebar > .nav-item > .nav-link > span {
  95. display: inline-block !important;
  96. }
  97. }
  98. }
  99. // Make an element visible only when sidebar mini is active
  100. .visible-sidebar-mini {
  101. display: block !important;
  102. }
  103. &.layout-fixed {
  104. .main-sidebar:hover {
  105. .brand-link {
  106. width: $sidebar-width;
  107. }
  108. }
  109. .brand-link {
  110. width: $sidebar-mini-width;
  111. }
  112. }
  113. }
  114. }
  115. // Logo style
  116. .logo-xs,
  117. .logo-xl {
  118. margin: 0;
  119. opacity: 1;
  120. position: absolute;
  121. visibility: visible;
  122. &.brand-image-xs {
  123. left: 18px;
  124. top: 12px;
  125. }
  126. &.brand-image-xl {
  127. left: 12px;
  128. top: 6px;
  129. }
  130. }
  131. .logo-xs {
  132. opacity: 0;
  133. visibility: hidden;
  134. &.brand-image-xl {
  135. left: 16px;
  136. top: 8px;
  137. }
  138. }
  139. .brand-link {
  140. &.logo-switch {
  141. &::before {
  142. content: '\00a0';
  143. }
  144. }
  145. }
  146. // Add sidebar-mini class to the body tag to activate this feature
  147. .sidebar-mini {
  148. @include media-breakpoint-up(lg) {
  149. @include sidebar-mini-breakpoint;
  150. }
  151. }
  152. .sidebar-mini-md {
  153. @include media-breakpoint-up(md) {
  154. @include sidebar-mini-breakpoint;
  155. }
  156. }
  157. .nav-sidebar {
  158. position: relative;
  159. &:hover {
  160. overflow: visible;
  161. }
  162. }
  163. .sidebar-form,
  164. .nav-sidebar > .nav-header {
  165. overflow: hidden;
  166. text-overflow: clip;
  167. }
  168. .nav-sidebar .nav-item > .nav-link {
  169. position: relative;
  170. > .float-right {
  171. margin-top: -7px;
  172. position: absolute;
  173. right: 10px;
  174. top: 50%;
  175. }
  176. }
  177. .sidebar .nav-link p,
  178. .main-sidebar .brand-text,
  179. .main-sidebar .logo-xs,
  180. .main-sidebar .logo-xl,
  181. .sidebar .user-panel .info {
  182. @include transition(margin-left $transition-speed linear, opacity $transition-speed ease, visibility $transition-speed ease)
  183. }