_sidebar-mini.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Component: Sidebar Mini
  3. */
  4. // Mixin
  5. @mixin sidebar-mini-breakpoint() {
  6. // A fix for text overflow while transitioning from sidebar mini to full sidebar
  7. .nav-sidebar,
  8. .nav-sidebar > .nav-header,
  9. .nav-sidebar .nav-link {
  10. white-space: nowrap;
  11. overflow: hidden;
  12. }
  13. // When the sidebar is collapsed...
  14. &.sidebar-collapse {
  15. .d-hidden-mini {
  16. display: none;
  17. }
  18. // Apply the new margins to the main content and footer
  19. .content-wrapper,
  20. .main-footer,
  21. .main-header {
  22. margin-left: $sidebar-mini-width !important;
  23. }
  24. // Make the sidebar headers
  25. .nav-sidebar .nav-header {
  26. display: none;
  27. }
  28. .nav-sidebar .nav-link p {
  29. width: 0;
  30. }
  31. .sidebar .user-panel > .info,
  32. .nav-sidebar .nav-link p,
  33. .brand-text {
  34. opacity: 0;
  35. margin-left: -10px;
  36. }
  37. // Modify the sidebar to shrink instead of disappearing
  38. .main-sidebar {
  39. &,
  40. &:before {
  41. // Don't go away! Just shrink
  42. margin-left: 0;
  43. width: $sidebar-mini-width;
  44. }
  45. .user-panel {
  46. .image {
  47. float: none;
  48. }
  49. }
  50. &:hover {
  51. width: $sidebar-width;
  52. .user-panel {
  53. text-align: left;
  54. .image {
  55. float: left;
  56. }
  57. }
  58. .user-panel > .info,
  59. .nav-sidebar .nav-link p,
  60. .brand-text {
  61. opacity: 1;
  62. margin-left: 0;
  63. display: inline-block;
  64. }
  65. .brand-image {
  66. margin-right: .5rem;
  67. }
  68. // Make the sidebar links, menus, labels, badges
  69. // and angle icons disappear
  70. .sidebar-form,
  71. .user-panel > .info {
  72. display: block !important;
  73. -webkit-transform: translateZ(0);
  74. }
  75. .nav-sidebar > .nav-item > .nav-link > span {
  76. display: inline-block !important;
  77. }
  78. }
  79. }
  80. // Make an element visible only when sidebar mini is active
  81. .visible-sidebar-mini {
  82. display: block !important;
  83. }
  84. }
  85. }
  86. // Add sidebar-mini class to the body tag to activate this feature
  87. .sidebar-mini {
  88. @include media-breakpoint-up(lg) {
  89. @include sidebar-mini-breakpoint();
  90. }
  91. }
  92. .sidebar-mini-md {
  93. @include media-breakpoint-up(md) {
  94. @include sidebar-mini-breakpoint();
  95. }
  96. }
  97. .nav-sidebar {
  98. position: relative;
  99. &:hover {
  100. overflow: visible;
  101. }
  102. }
  103. .sidebar-form,
  104. .nav-sidebar > .nav-header {
  105. overflow: hidden;
  106. text-overflow: clip;
  107. }
  108. .nav-sidebar .nav-item > .nav-link {
  109. position: relative;
  110. > .float-right {
  111. position: absolute;
  112. right: 10px;
  113. top: 50%;
  114. margin-top: -7px;
  115. }
  116. }
  117. .sidebar .nav-link p,
  118. .main-sidebar .brand-text,
  119. .sidebar .user-panel .info {
  120. @include transition(margin-left $transition-speed linear, opacity .5s ease)
  121. }