_main-sidebar.scss 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. //
  2. // Component: Main Sidebar
  3. //
  4. .main-sidebar {
  5. height: 100vh;
  6. overflow-y: hidden;
  7. z-index: $zindex-main-sidebar;
  8. }
  9. .sidebar {
  10. height: calc(100% - 4rem);
  11. overflow-y: auto;
  12. padding-bottom: $sidebar-padding-y;
  13. padding-left: $sidebar-padding-x;
  14. padding-right: $sidebar-padding-x;
  15. padding-top: $sidebar-padding-y;
  16. }
  17. // Sidebar user panel
  18. .user-panel {
  19. position: relative;
  20. [class*='sidebar-dark'] & {
  21. border-bottom: 1px solid lighten($dark, 12%);
  22. }
  23. [class*='sidebar-light'] & {
  24. border-bottom: 1px solid $gray-300;
  25. }
  26. &,
  27. .info {
  28. overflow: hidden;
  29. white-space: nowrap;
  30. }
  31. .image {
  32. display: inline-block;
  33. padding-left: $nav-link-padding-x - .2;
  34. }
  35. img {
  36. height: auto;
  37. width: $sidebar-user-image-width;
  38. }
  39. .info {
  40. display: inline-block;
  41. padding: 5px 5px 5px 10px;
  42. }
  43. .status,
  44. .dropdown-menu {
  45. font-size: $font-size-sm;
  46. }
  47. }
  48. // Sidebar navigation menu
  49. .nav-sidebar {
  50. // All levels
  51. .nav-item {
  52. > .nav-link {
  53. margin-bottom: .2rem;
  54. .right {
  55. @include transition(transform $transition-fn $transition-speed);
  56. }
  57. }
  58. }
  59. .nav-link > .right,
  60. .nav-link > p > .right {
  61. position: absolute;
  62. right: 1rem;
  63. top: .7rem;
  64. i,
  65. span {
  66. margin-left: .5rem;
  67. }
  68. &:nth-child(2) {
  69. right: 2.2rem;
  70. }
  71. }
  72. .menu-open {
  73. > .nav-treeview {
  74. display: block;
  75. }
  76. > .nav-link {
  77. i.right {
  78. @include rotate(-90deg);
  79. }
  80. }
  81. }
  82. // First Level
  83. > .nav-item {
  84. margin-bottom: 0;
  85. .nav-icon {
  86. font-size: 1.2rem;
  87. margin-right: .2rem;
  88. text-align: center;
  89. width: $sidebar-nav-icon-width;
  90. &.fa,
  91. &.fas,
  92. &.far,
  93. &.fab,
  94. &.glyphicon,
  95. &.ion {
  96. font-size: 1.1rem;
  97. }
  98. }
  99. .float-right {
  100. margin-top: 3px;
  101. }
  102. }
  103. // Tree view menu
  104. .nav-treeview {
  105. display: none;
  106. list-style: none;
  107. padding: 0;
  108. > .nav-item {
  109. > .nav-link {
  110. > .nav-icon {
  111. width: $sidebar-nav-icon-width;
  112. }
  113. }
  114. }
  115. }
  116. &.nav-child-indent {
  117. .nav-treeview {
  118. transition: padding $transition-speed $transition-fn;
  119. padding-left: 1rem;
  120. }
  121. }
  122. .nav-header {
  123. font-size: .9rem;
  124. padding: $nav-link-padding-y;
  125. &:not(:first-of-type) {
  126. padding: 1.7rem 1rem .5rem;
  127. }
  128. }
  129. .nav-link p {
  130. display: inline-block;
  131. margin: 0;
  132. }
  133. }
  134. #sidebar-overlay {
  135. @include media-breakpoint-down(md) {
  136. .sidebar-open & {
  137. display: block;
  138. }
  139. }
  140. background-color: rgba($black, 0.1);
  141. bottom: 0;
  142. display: none;
  143. left: 0;
  144. position: fixed;
  145. right: 0;
  146. top: 0;
  147. z-index: $zindex-main-sidebar - 1;
  148. }
  149. .sidebar-mini-md {
  150. &.sidebar-open {
  151. #sidebar-overlay {
  152. @include media-breakpoint-up(sm) {
  153. display: none;
  154. }
  155. @include media-breakpoint-down(sm) {
  156. display: block;
  157. }
  158. }
  159. }
  160. }
  161. [class*='sidebar-light-'] {
  162. // Sidebar background color
  163. background-color: $sidebar-light-bg;
  164. // User Panel (resides in the sidebar)
  165. .user-panel {
  166. a:hover {
  167. color: $sidebar-light-hover-color;
  168. }
  169. .status {
  170. background: $sidebar-light-hover-bg;
  171. color: $sidebar-light-color;
  172. &:hover,
  173. &:focus,
  174. &:active {
  175. background: darken($sidebar-light-hover-bg, 3%);
  176. color: $sidebar-light-hover-color;
  177. }
  178. }
  179. .dropdown-menu {
  180. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  181. border-color: darken($sidebar-light-hover-bg, 5%);
  182. }
  183. .dropdown-item {
  184. color: $body-color;
  185. }
  186. }
  187. // Sidebar Menu. First level links
  188. .nav-sidebar > .nav-item {
  189. // links
  190. > .nav-link {
  191. // border-left: 3px solid transparent;
  192. &:active,
  193. &:focus {
  194. color: $sidebar-light-color;
  195. }
  196. }
  197. // Hover and active states
  198. &.menu-open > .nav-link,
  199. &:hover > .nav-link {
  200. background-color: $sidebar-light-hover-bg;
  201. color: $sidebar-light-hover-color;
  202. }
  203. > .nav-link.active {
  204. color: $sidebar-light-active-color;
  205. @if $enable-shadows {
  206. @extend .elevation-1;
  207. }
  208. }
  209. // First Level Submenu
  210. > .nav-treeview {
  211. background: $sidebar-light-submenu-bg;
  212. }
  213. }
  214. // Section Heading
  215. .nav-header {
  216. background: inherit;
  217. color: darken($sidebar-light-color, 5%);
  218. }
  219. // All links within the sidebar menu
  220. .sidebar {
  221. a {
  222. color: $sidebar-light-color;
  223. &:hover {
  224. text-decoration: none;
  225. }
  226. }
  227. }
  228. // All submenus
  229. .nav-treeview {
  230. > .nav-item {
  231. > .nav-link {
  232. color: $sidebar-light-submenu-color;
  233. }
  234. > .nav-link.active {
  235. &,
  236. &:hover {
  237. background-color: $sidebar-light-submenu-active-bg;
  238. color: $sidebar-light-submenu-active-color;
  239. }
  240. }
  241. > .nav-link:hover {
  242. background-color: $sidebar-light-submenu-hover-bg;
  243. }
  244. }
  245. }
  246. }
  247. [class*='sidebar-dark-'] {
  248. // Sidebar background color
  249. background-color: $sidebar-dark-bg;
  250. // User Panel (resides in the sidebar)
  251. .user-panel {
  252. a:hover {
  253. color: $sidebar-dark-hover-color;
  254. }
  255. .status {
  256. background: $sidebar-dark-hover-bg;
  257. color: $sidebar-dark-color;
  258. &:hover,
  259. &:focus,
  260. &:active {
  261. background: darken($sidebar-dark-hover-bg, 3%);
  262. color: $sidebar-dark-hover-color;
  263. }
  264. }
  265. .dropdown-menu {
  266. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  267. border-color: darken($sidebar-dark-hover-bg, 5%);
  268. }
  269. .dropdown-item {
  270. color: $body-color;
  271. }
  272. }
  273. // Sidebar Menu. First level links
  274. .nav-sidebar > .nav-item {
  275. // links
  276. > .nav-link {
  277. // border-left: 3px solid transparent;
  278. &:active {
  279. color: $sidebar-dark-color;
  280. }
  281. }
  282. // Hover and active states
  283. &.menu-open > .nav-link,
  284. &:hover > .nav-link,
  285. & > .nav-link:focus {
  286. background-color: $sidebar-dark-hover-bg;
  287. color: $sidebar-dark-hover-color;
  288. }
  289. > .nav-link.active {
  290. color: $sidebar-dark-hover-color;
  291. @if $enable-shadows {
  292. @extend .elevation-1;
  293. }
  294. }
  295. // First Level Submenu
  296. > .nav-treeview {
  297. background: $sidebar-dark-submenu-bg;
  298. }
  299. }
  300. // Section Heading
  301. .nav-header {
  302. background: inherit; //darken($sidebar-dark-bg, 3%);
  303. color: lighten($sidebar-dark-color, 5%);
  304. }
  305. // All links within the sidebar menu
  306. .sidebar {
  307. a {
  308. color: $sidebar-dark-color;
  309. &:hover,
  310. &:focus {
  311. text-decoration: none;
  312. }
  313. }
  314. }
  315. // All submenus
  316. .nav-treeview {
  317. > .nav-item {
  318. > .nav-link {
  319. color: $sidebar-dark-submenu-color;
  320. &:hover,
  321. &:focus {
  322. background-color: $sidebar-dark-submenu-hover-bg;
  323. color: $sidebar-dark-submenu-hover-color;
  324. }
  325. }
  326. > .nav-link.active {
  327. &,
  328. &:hover,
  329. &:focus {
  330. background-color: $sidebar-dark-submenu-active-bg;
  331. color: $sidebar-dark-submenu-active-color;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. // Sidebar variants
  338. @each $name, $color in $theme-colors {
  339. .sidebar-dark-#{$name},
  340. .sidebar-light-#{$name} {
  341. @include sidebar-color($color)
  342. }
  343. }
  344. @each $name, $color in $colors {
  345. .sidebar-dark-#{$name},
  346. .sidebar-light-#{$name} {
  347. @include sidebar-color($color)
  348. }
  349. }
  350. // Nav Compact
  351. .nav-compact {
  352. .nav-link,
  353. .nav-header {
  354. padding: ($nav-link-padding-y / 2) ($nav-link-padding-x / 2);
  355. }
  356. .nav-header:not(:first-of-type) {
  357. padding: ($nav-link-padding-y * 1.5) ($nav-link-padding-x / 2) ($nav-link-padding-y / 2);
  358. }
  359. .nav-link > .right,
  360. .nav-link > p > .right {
  361. top: .5rem;
  362. right: .5rem;
  363. &:nth-child(2) {
  364. right: 1.6rem;
  365. }
  366. }
  367. }