_main-sidebar.scss 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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. [class*='sidebar-light-'] {
  150. // Sidebar background color
  151. background-color: $sidebar-light-bg;
  152. // User Panel (resides in the sidebar)
  153. .user-panel {
  154. a:hover {
  155. color: $sidebar-light-hover-color;
  156. }
  157. .status {
  158. background: $sidebar-light-hover-bg;
  159. color: $sidebar-light-color;
  160. &:hover,
  161. &:focus,
  162. &:active {
  163. background: darken($sidebar-light-hover-bg, 3%);
  164. color: $sidebar-light-hover-color;
  165. }
  166. }
  167. .dropdown-menu {
  168. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  169. border-color: darken($sidebar-light-hover-bg, 5%);
  170. }
  171. .dropdown-item {
  172. color: $body-color;
  173. }
  174. }
  175. // Sidebar Menu. First level links
  176. .nav-sidebar > .nav-item {
  177. // links
  178. > .nav-link {
  179. // border-left: 3px solid transparent;
  180. &:active,
  181. &:focus {
  182. color: $sidebar-light-color;
  183. }
  184. }
  185. // Hover and active states
  186. &.menu-open > .nav-link,
  187. &:hover > .nav-link {
  188. background-color: $sidebar-light-hover-bg;
  189. color: $sidebar-light-hover-color;
  190. }
  191. > .nav-link.active {
  192. color: $sidebar-light-active-color;
  193. @if $enable-shadows {
  194. @extend .elevation-1;
  195. }
  196. }
  197. // First Level Submenu
  198. > .nav-treeview {
  199. background: $sidebar-light-submenu-bg;
  200. }
  201. }
  202. // Section Heading
  203. .nav-header {
  204. background: inherit;
  205. color: darken($sidebar-light-color, 5%);
  206. }
  207. // All links within the sidebar menu
  208. .sidebar {
  209. a {
  210. color: $sidebar-light-color;
  211. &:hover {
  212. text-decoration: none;
  213. }
  214. }
  215. }
  216. // All submenus
  217. .nav-treeview {
  218. > .nav-item {
  219. > .nav-link {
  220. color: $sidebar-light-submenu-color;
  221. }
  222. > .nav-link.active {
  223. &,
  224. &:hover {
  225. background-color: $sidebar-light-submenu-active-bg;
  226. color: $sidebar-light-submenu-active-color;
  227. }
  228. }
  229. > .nav-link:hover {
  230. background-color: $sidebar-light-submenu-hover-bg;
  231. }
  232. }
  233. }
  234. // Flat style
  235. .nav-flat {
  236. .nav-item {
  237. .nav-treeview {
  238. .nav-treeview {
  239. border-color: $sidebar-light-submenu-active-bg;
  240. }
  241. > .nav-item {
  242. > .nav-link {
  243. &,
  244. &.active {
  245. border-color: $sidebar-light-submenu-active-bg;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. }
  253. [class*='sidebar-dark-'] {
  254. // Sidebar background color
  255. background-color: $sidebar-dark-bg;
  256. // User Panel (resides in the sidebar)
  257. .user-panel {
  258. a:hover {
  259. color: $sidebar-dark-hover-color;
  260. }
  261. .status {
  262. background: $sidebar-dark-hover-bg;
  263. color: $sidebar-dark-color;
  264. &:hover,
  265. &:focus,
  266. &:active {
  267. background: darken($sidebar-dark-hover-bg, 3%);
  268. color: $sidebar-dark-hover-color;
  269. }
  270. }
  271. .dropdown-menu {
  272. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  273. border-color: darken($sidebar-dark-hover-bg, 5%);
  274. }
  275. .dropdown-item {
  276. color: $body-color;
  277. }
  278. }
  279. // Sidebar Menu. First level links
  280. .nav-sidebar > .nav-item {
  281. // links
  282. > .nav-link {
  283. // border-left: 3px solid transparent;
  284. &:active {
  285. color: $sidebar-dark-color;
  286. }
  287. }
  288. // Hover and active states
  289. &.menu-open > .nav-link,
  290. &:hover > .nav-link,
  291. & > .nav-link:focus {
  292. background-color: $sidebar-dark-hover-bg;
  293. color: $sidebar-dark-hover-color;
  294. }
  295. > .nav-link.active {
  296. color: $sidebar-dark-hover-color;
  297. @if $enable-shadows {
  298. @extend .elevation-1;
  299. }
  300. }
  301. // First Level Submenu
  302. > .nav-treeview {
  303. background: $sidebar-dark-submenu-bg;
  304. }
  305. }
  306. // Section Heading
  307. .nav-header {
  308. background: inherit; //darken($sidebar-dark-bg, 3%);
  309. color: lighten($sidebar-dark-color, 5%);
  310. }
  311. // All links within the sidebar menu
  312. .sidebar {
  313. a {
  314. color: $sidebar-dark-color;
  315. &:hover,
  316. &:focus {
  317. text-decoration: none;
  318. }
  319. }
  320. }
  321. // All submenus
  322. .nav-treeview {
  323. > .nav-item {
  324. > .nav-link {
  325. color: $sidebar-dark-submenu-color;
  326. &:hover,
  327. &:focus {
  328. background-color: $sidebar-dark-submenu-hover-bg;
  329. color: $sidebar-dark-submenu-hover-color;
  330. }
  331. }
  332. > .nav-link.active {
  333. &,
  334. &:hover,
  335. &:focus {
  336. background-color: $sidebar-dark-submenu-active-bg;
  337. color: $sidebar-dark-submenu-active-color;
  338. }
  339. }
  340. }
  341. }
  342. // Flat Style
  343. .nav-flat {
  344. .nav-item {
  345. .nav-treeview {
  346. .nav-treeview {
  347. border-color: $sidebar-dark-submenu-active-bg;
  348. }
  349. > .nav-item {
  350. > .nav-link {
  351. &,
  352. &.active {
  353. border-color: $sidebar-dark-submenu-active-bg;
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }
  361. // Sidebar variants
  362. @each $name, $color in $theme-colors {
  363. .sidebar-dark-#{$name},
  364. .sidebar-light-#{$name} {
  365. @include sidebar-color($color)
  366. }
  367. }
  368. @each $name, $color in $colors {
  369. .sidebar-dark-#{$name},
  370. .sidebar-light-#{$name} {
  371. @include sidebar-color($color)
  372. }
  373. }
  374. // Nav Flat
  375. .nav-flat {
  376. margin: (-$sidebar-padding-x/2) (-$sidebar-padding-x) 0;
  377. &.nav-child-indent {
  378. .nav-treeview {
  379. padding-left: 0 !important;
  380. .nav-treeview {
  381. border-left: .2rem solid;
  382. }
  383. }
  384. }
  385. .nav-item {
  386. > .nav-link {
  387. border-radius: 0;
  388. margin-bottom: 0;
  389. }
  390. }
  391. .nav-icon {
  392. @include transition(margin-left $transition-fn $transition-speed);
  393. }
  394. .nav-treeview {
  395. .nav-icon {
  396. margin-left: -.2rem;
  397. }
  398. }
  399. .sidebar-collapse & {
  400. .nav-icon {
  401. margin-left: .5rem;
  402. }
  403. .nav-treeview {
  404. .nav-icon {
  405. margin-left: .3rem;
  406. }
  407. }
  408. }
  409. &.nav-sidebar > .nav-item {
  410. .nav-treeview,
  411. > .nav-treeview {
  412. background: rgba($white, .05);
  413. .nav-item {
  414. > .nav-link {
  415. border-left: .2rem solid;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. // Nav Compact
  422. .nav-compact {
  423. .nav-link,
  424. .nav-header {
  425. padding: ($nav-link-padding-y / 2) ($nav-link-padding-x / 2);
  426. }
  427. .nav-header:not(:first-of-type) {
  428. padding: ($nav-link-padding-y * 1.5) ($nav-link-padding-x / 2) ($nav-link-padding-y / 2);
  429. }
  430. .nav-link > .right,
  431. .nav-link > p > .right {
  432. top: .5rem;
  433. right: .5rem;
  434. &:nth-child(2) {
  435. right: 1.6rem;
  436. }
  437. }
  438. }
  439. // Sidebar Form Control
  440. [class*='sidebar-dark'] {
  441. .form-control-sidebar,
  442. .btn-sidebar {
  443. background: lighten($sidebar-dark-bg, 5%);
  444. border: 1px solid lighten($sidebar-dark-bg, 15%);
  445. color: lighten(color-yiq(lighten($sidebar-dark-bg, 5%)), 15%);
  446. }
  447. .form-control-sidebar:focus,
  448. .btn-sidebar:focus {
  449. border: 1px solid lighten($sidebar-dark-bg, 30%);
  450. }
  451. .btn-sidebar:hover {
  452. background: lighten($sidebar-dark-bg, 7.5%);
  453. }
  454. .btn-sidebar:focus {
  455. background: lighten($sidebar-dark-bg, 10%);
  456. }
  457. }
  458. [class*='sidebar-light'] {
  459. .form-control-sidebar,
  460. .btn-sidebar {
  461. background: darken($sidebar-light-bg, 5%);
  462. border: 1px solid darken($sidebar-light-bg, 15%);
  463. color: color-yiq(darken($sidebar-light-bg, 5%));
  464. }
  465. .form-control-sidebar:focus,
  466. .btn-sidebar:focus {
  467. border: 1px solid darken($sidebar-light-bg, 30%);
  468. }
  469. .btn-sidebar:hover {
  470. background: darken($sidebar-light-bg, 7.5%);
  471. }
  472. .btn-sidebar:focus {
  473. background: darken($sidebar-light-bg, 10%);
  474. }
  475. }