_main-sidebar.scss 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. //
  2. // Component: Main Sidebar
  3. //
  4. .main-sidebar {
  5. height: 100vh;
  6. overflow-y: hidden;
  7. z-index: $zindex-main-sidebar;
  8. // Remove Firefox Focusring
  9. a {
  10. &:-moz-focusring {
  11. border: 0;
  12. outline: none;
  13. }
  14. }
  15. }
  16. .sidebar {
  17. height: calc(100% - 4rem);
  18. overflow-y: auto;
  19. padding-bottom: $sidebar-padding-y;
  20. padding-left: $sidebar-padding-x;
  21. padding-right: $sidebar-padding-x;
  22. padding-top: $sidebar-padding-y;
  23. }
  24. // Sidebar user panel
  25. .user-panel {
  26. position: relative;
  27. [class*='sidebar-dark'] & {
  28. border-bottom: 1px solid lighten($dark, 12%);
  29. }
  30. [class*='sidebar-light'] & {
  31. border-bottom: 1px solid $gray-300;
  32. }
  33. &,
  34. .info {
  35. overflow: hidden;
  36. white-space: nowrap;
  37. }
  38. .image {
  39. display: inline-block;
  40. padding-left: $nav-link-padding-x - .2;
  41. }
  42. img {
  43. height: auto;
  44. width: $sidebar-user-image-width;
  45. }
  46. .info {
  47. display: inline-block;
  48. padding: 5px 5px 5px 10px;
  49. }
  50. .status,
  51. .dropdown-menu {
  52. font-size: $font-size-sm;
  53. }
  54. }
  55. // Sidebar navigation menu
  56. .nav-sidebar {
  57. // All levels
  58. .nav-item {
  59. > .nav-link {
  60. margin-bottom: .2rem;
  61. .right {
  62. @include transition(transform $transition-fn $transition-speed);
  63. }
  64. }
  65. }
  66. .nav-link > .right,
  67. .nav-link > p > .right {
  68. position: absolute;
  69. right: 1rem;
  70. top: .7rem;
  71. i,
  72. span {
  73. margin-left: .5rem;
  74. }
  75. &:nth-child(2) {
  76. right: 2.2rem;
  77. }
  78. }
  79. .menu-open {
  80. > .nav-treeview {
  81. display: block;
  82. }
  83. > .nav-link {
  84. i.right {
  85. @include rotate(-90deg);
  86. }
  87. }
  88. }
  89. // First Level
  90. > .nav-item {
  91. margin-bottom: 0;
  92. .nav-icon {
  93. font-size: 1.2rem;
  94. margin-right: .2rem;
  95. text-align: center;
  96. width: $sidebar-nav-icon-width;
  97. &.fa,
  98. &.fas,
  99. &.far,
  100. &.fab,
  101. &.glyphicon,
  102. &.ion {
  103. font-size: 1.1rem;
  104. }
  105. }
  106. .float-right {
  107. margin-top: 3px;
  108. }
  109. }
  110. // Tree view menu
  111. .nav-treeview {
  112. display: none;
  113. list-style: none;
  114. padding: 0;
  115. > .nav-item {
  116. > .nav-link {
  117. > .nav-icon {
  118. width: $sidebar-nav-icon-width;
  119. }
  120. }
  121. }
  122. }
  123. &.nav-child-indent {
  124. .nav-treeview {
  125. transition: padding $transition-speed $transition-fn;
  126. padding-left: 1rem;
  127. }
  128. }
  129. .nav-header {
  130. font-size: .9rem;
  131. padding: $nav-link-padding-y;
  132. &:not(:first-of-type) {
  133. padding: 1.7rem 1rem .5rem;
  134. }
  135. }
  136. .nav-link p {
  137. display: inline-block;
  138. margin: 0;
  139. }
  140. }
  141. #sidebar-overlay {
  142. @include media-breakpoint-down(md) {
  143. .sidebar-open & {
  144. display: block;
  145. }
  146. }
  147. background-color: rgba($black, 0.1);
  148. bottom: 0;
  149. display: none;
  150. left: 0;
  151. position: fixed;
  152. right: 0;
  153. top: 0;
  154. z-index: $zindex-main-sidebar - 1;
  155. }
  156. [class*='sidebar-light-'] {
  157. // Sidebar background color
  158. background-color: $sidebar-light-bg;
  159. // User Panel (resides in the sidebar)
  160. .user-panel {
  161. a:hover {
  162. color: $sidebar-light-hover-color;
  163. }
  164. .status {
  165. background: $sidebar-light-hover-bg;
  166. color: $sidebar-light-color;
  167. &:hover,
  168. &:focus,
  169. &:active {
  170. background: darken($sidebar-light-hover-bg, 3%);
  171. color: $sidebar-light-hover-color;
  172. }
  173. }
  174. .dropdown-menu {
  175. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  176. border-color: darken($sidebar-light-hover-bg, 5%);
  177. }
  178. .dropdown-item {
  179. color: $body-color;
  180. }
  181. }
  182. // Sidebar Menu. First level links
  183. .nav-sidebar > .nav-item {
  184. // links
  185. > .nav-link {
  186. // border-left: 3px solid transparent;
  187. &:active,
  188. &:focus {
  189. color: $sidebar-light-color;
  190. }
  191. }
  192. // Hover and active states
  193. &.menu-open > .nav-link,
  194. &:hover > .nav-link {
  195. background-color: $sidebar-light-hover-bg;
  196. color: $sidebar-light-hover-color;
  197. }
  198. > .nav-link.active {
  199. color: $sidebar-light-active-color;
  200. @if $enable-shadows {
  201. box-shadow: map-get($elevations, 1);
  202. }
  203. }
  204. // First Level Submenu
  205. > .nav-treeview {
  206. background: $sidebar-light-submenu-bg;
  207. }
  208. }
  209. // Section Heading
  210. .nav-header {
  211. background: inherit;
  212. color: darken($sidebar-light-color, 5%);
  213. }
  214. // All links within the sidebar menu
  215. .sidebar {
  216. a {
  217. color: $sidebar-light-color;
  218. &:hover {
  219. text-decoration: none;
  220. }
  221. }
  222. }
  223. // All submenus
  224. .nav-treeview {
  225. > .nav-item {
  226. > .nav-link {
  227. color: $sidebar-light-submenu-color;
  228. }
  229. > .nav-link.active {
  230. &,
  231. &:hover {
  232. background-color: $sidebar-light-submenu-active-bg;
  233. color: $sidebar-light-submenu-active-color;
  234. }
  235. }
  236. > .nav-link:hover {
  237. background-color: $sidebar-light-submenu-hover-bg;
  238. }
  239. }
  240. }
  241. // Flat style
  242. .nav-flat {
  243. .nav-item {
  244. .nav-treeview {
  245. .nav-treeview {
  246. border-color: $sidebar-light-submenu-active-bg;
  247. }
  248. > .nav-item {
  249. > .nav-link {
  250. &,
  251. &.active {
  252. border-color: $sidebar-light-submenu-active-bg;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. }
  260. [class*='sidebar-dark-'] {
  261. // Sidebar background color
  262. background-color: $sidebar-dark-bg;
  263. // User Panel (resides in the sidebar)
  264. .user-panel {
  265. a:hover {
  266. color: $sidebar-dark-hover-color;
  267. }
  268. .status {
  269. background: $sidebar-dark-hover-bg;
  270. color: $sidebar-dark-color;
  271. &:hover,
  272. &:focus,
  273. &:active {
  274. background: darken($sidebar-dark-hover-bg, 3%);
  275. color: $sidebar-dark-hover-color;
  276. }
  277. }
  278. .dropdown-menu {
  279. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  280. border-color: darken($sidebar-dark-hover-bg, 5%);
  281. }
  282. .dropdown-item {
  283. color: $body-color;
  284. }
  285. }
  286. // Sidebar Menu. First level links
  287. .nav-sidebar > .nav-item {
  288. // links
  289. > .nav-link {
  290. // border-left: 3px solid transparent;
  291. &:active {
  292. color: $sidebar-dark-color;
  293. }
  294. }
  295. // Hover and active states
  296. &.menu-open > .nav-link,
  297. &:hover > .nav-link,
  298. & > .nav-link:focus {
  299. background-color: $sidebar-dark-hover-bg;
  300. color: $sidebar-dark-hover-color;
  301. }
  302. > .nav-link.active {
  303. color: $sidebar-dark-hover-color;
  304. @if $enable-shadows {
  305. box-shadow: map-get($elevations, 1);
  306. }
  307. }
  308. // First Level Submenu
  309. > .nav-treeview {
  310. background: $sidebar-dark-submenu-bg;
  311. }
  312. }
  313. // Section Heading
  314. .nav-header {
  315. background: inherit; //darken($sidebar-dark-bg, 3%);
  316. color: lighten($sidebar-dark-color, 5%);
  317. }
  318. // All links within the sidebar menu
  319. .sidebar {
  320. a {
  321. color: $sidebar-dark-color;
  322. &:hover,
  323. &:focus {
  324. text-decoration: none;
  325. }
  326. }
  327. }
  328. // All submenus
  329. .nav-treeview {
  330. > .nav-item {
  331. > .nav-link {
  332. color: $sidebar-dark-submenu-color;
  333. &:hover,
  334. &:focus {
  335. background-color: $sidebar-dark-submenu-hover-bg;
  336. color: $sidebar-dark-submenu-hover-color;
  337. }
  338. }
  339. > .nav-link.active {
  340. &,
  341. &:hover,
  342. &:focus {
  343. background-color: $sidebar-dark-submenu-active-bg;
  344. color: $sidebar-dark-submenu-active-color;
  345. }
  346. }
  347. }
  348. }
  349. // Flat Style
  350. .nav-flat {
  351. .nav-item {
  352. .nav-treeview {
  353. .nav-treeview {
  354. border-color: $sidebar-dark-submenu-active-bg;
  355. }
  356. > .nav-item {
  357. > .nav-link {
  358. &,
  359. &.active {
  360. border-color: $sidebar-dark-submenu-active-bg;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. }
  367. }
  368. // Sidebar variants
  369. @each $name, $color in $theme-colors {
  370. .sidebar-dark-#{$name},
  371. .sidebar-light-#{$name} {
  372. @include sidebar-color($color)
  373. }
  374. }
  375. @each $name, $color in $colors {
  376. .sidebar-dark-#{$name},
  377. .sidebar-light-#{$name} {
  378. @include sidebar-color($color)
  379. }
  380. }
  381. // Nav Flat
  382. .nav-flat {
  383. margin: (-$sidebar-padding-x/2) (-$sidebar-padding-x) 0;
  384. &.nav-child-indent {
  385. .nav-treeview {
  386. padding-left: 0 !important;
  387. .nav-treeview {
  388. border-left: .2rem solid;
  389. }
  390. }
  391. }
  392. .nav-item {
  393. > .nav-link {
  394. border-radius: 0;
  395. margin-bottom: 0;
  396. }
  397. }
  398. .nav-icon {
  399. @include transition(margin-left $transition-fn $transition-speed);
  400. }
  401. .nav-treeview {
  402. .nav-icon {
  403. margin-left: -.2rem;
  404. }
  405. }
  406. .sidebar-collapse & {
  407. .nav-icon {
  408. margin-left: .5rem;
  409. }
  410. .nav-treeview {
  411. .nav-icon {
  412. margin-left: .3rem;
  413. }
  414. }
  415. }
  416. &.nav-sidebar > .nav-item {
  417. .nav-treeview,
  418. > .nav-treeview {
  419. background: rgba($white, .05);
  420. .nav-item {
  421. > .nav-link {
  422. border-left: .2rem solid;
  423. }
  424. }
  425. }
  426. }
  427. }
  428. .nav-legacy {
  429. margin: (-$sidebar-padding-x/2) (-$sidebar-padding-x) 0;
  430. &.nav-sidebar .nav-item {
  431. > .nav-link {
  432. border-radius: 0;
  433. margin-bottom: 0;
  434. }
  435. }
  436. &.nav-sidebar > .nav-item {
  437. > .nav-link {
  438. &.active {
  439. background: inherit;
  440. border-left: 3px solid transparent;
  441. box-shadow: none;
  442. > .nav-icon {
  443. margin-left: -3px;
  444. }
  445. }
  446. }
  447. }
  448. [class*='sidebar-dark'] & {
  449. &.nav-sidebar > .nav-item {
  450. .nav-treeview,
  451. > .nav-treeview {
  452. background: rgba($white, .05);
  453. }
  454. > .nav-link.active {
  455. color: $sidebar-dark-active-color;
  456. }
  457. }
  458. .nav-treeview > .nav-item > .nav-link {
  459. &.active,
  460. &:focus,
  461. &:hover {
  462. background: none;
  463. color: $sidebar-dark-active-color;
  464. }
  465. }
  466. }
  467. [class*='sidebar-light'] & {
  468. &.nav-sidebar > .nav-item {
  469. .nav-treeview,
  470. > .nav-treeview {
  471. background: rgba($black, .05);
  472. }
  473. > .nav-link.active {
  474. color: $sidebar-light-active-color;
  475. }
  476. }
  477. .nav-treeview > .nav-item > .nav-link {
  478. &.active,
  479. &:focus,
  480. &:hover {
  481. background: none;
  482. color: $sidebar-light-active-color;
  483. }
  484. }
  485. }
  486. }
  487. .nav-collapse-hide-child {
  488. .menu-open > .nav-treeview {
  489. max-height: min-content;
  490. opacity: 1;
  491. }
  492. .sidebar-collapse & {
  493. .menu-open > .nav-treeview {
  494. max-height: 0;
  495. opacity: 0;
  496. }
  497. }
  498. .sidebar-mini.sidebar-collapse .main-sidebar.sidebar-focused &,
  499. .sidebar-mini.sidebar-collapse .main-sidebar:hover & {
  500. .menu-open > .nav-treeview {
  501. max-height: min-content;
  502. opacity: 1;
  503. }
  504. }
  505. }
  506. // Nav Compact
  507. .nav-compact {
  508. .nav-link,
  509. .nav-header {
  510. padding: ($nav-link-padding-y / 2) ($nav-link-padding-x / 2);
  511. }
  512. .nav-header:not(:first-of-type) {
  513. padding: ($nav-link-padding-y * 1.5) ($nav-link-padding-x / 2) ($nav-link-padding-y / 2);
  514. }
  515. .nav-link > .right,
  516. .nav-link > p > .right {
  517. top: .5rem;
  518. right: .5rem;
  519. &:nth-child(2) {
  520. right: 1.6rem;
  521. }
  522. }
  523. }
  524. // Sidebar Form Control
  525. [class*='sidebar-dark'] {
  526. .form-control-sidebar,
  527. .btn-sidebar {
  528. background: lighten($sidebar-dark-bg, 5%);
  529. border: 1px solid lighten($sidebar-dark-bg, 15%);
  530. color: lighten(color-yiq(lighten($sidebar-dark-bg, 5%)), 15%);
  531. }
  532. .form-control-sidebar:focus,
  533. .btn-sidebar:focus {
  534. border: 1px solid lighten($sidebar-dark-bg, 30%);
  535. }
  536. .btn-sidebar:hover {
  537. background: lighten($sidebar-dark-bg, 7.5%);
  538. }
  539. .btn-sidebar:focus {
  540. background: lighten($sidebar-dark-bg, 10%);
  541. }
  542. }
  543. [class*='sidebar-light'] {
  544. .form-control-sidebar,
  545. .btn-sidebar {
  546. background: darken($sidebar-light-bg, 5%);
  547. border: 1px solid darken($sidebar-light-bg, 15%);
  548. color: color-yiq(darken($sidebar-light-bg, 5%));
  549. }
  550. .form-control-sidebar:focus,
  551. .btn-sidebar:focus {
  552. border: 1px solid darken($sidebar-light-bg, 30%);
  553. }
  554. .btn-sidebar:hover {
  555. background: darken($sidebar-light-bg, 7.5%);
  556. }
  557. .btn-sidebar:focus {
  558. background: darken($sidebar-light-bg, 10%);
  559. }
  560. }