_main-sidebar.scss 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. // Flat style
  247. .nav-flat {
  248. .nav-item {
  249. .nav-treeview {
  250. .nav-treeview {
  251. border-color: $sidebar-light-submenu-active-bg;
  252. }
  253. > .nav-item {
  254. > .nav-link {
  255. border-color: $sidebar-light-submenu-active-bg;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. [class*='sidebar-dark-'] {
  263. // Sidebar background color
  264. background-color: $sidebar-dark-bg;
  265. // User Panel (resides in the sidebar)
  266. .user-panel {
  267. a:hover {
  268. color: $sidebar-dark-hover-color;
  269. }
  270. .status {
  271. background: $sidebar-dark-hover-bg;
  272. color: $sidebar-dark-color;
  273. &:hover,
  274. &:focus,
  275. &:active {
  276. background: darken($sidebar-dark-hover-bg, 3%);
  277. color: $sidebar-dark-hover-color;
  278. }
  279. }
  280. .dropdown-menu {
  281. @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
  282. border-color: darken($sidebar-dark-hover-bg, 5%);
  283. }
  284. .dropdown-item {
  285. color: $body-color;
  286. }
  287. }
  288. // Sidebar Menu. First level links
  289. .nav-sidebar > .nav-item {
  290. // links
  291. > .nav-link {
  292. // border-left: 3px solid transparent;
  293. &:active {
  294. color: $sidebar-dark-color;
  295. }
  296. }
  297. // Hover and active states
  298. &.menu-open > .nav-link,
  299. &:hover > .nav-link,
  300. & > .nav-link:focus {
  301. background-color: $sidebar-dark-hover-bg;
  302. color: $sidebar-dark-hover-color;
  303. }
  304. > .nav-link.active {
  305. color: $sidebar-dark-hover-color;
  306. @if $enable-shadows {
  307. @extend .elevation-1;
  308. }
  309. }
  310. // First Level Submenu
  311. > .nav-treeview {
  312. background: $sidebar-dark-submenu-bg;
  313. }
  314. }
  315. // Section Heading
  316. .nav-header {
  317. background: inherit; //darken($sidebar-dark-bg, 3%);
  318. color: lighten($sidebar-dark-color, 5%);
  319. }
  320. // All links within the sidebar menu
  321. .sidebar {
  322. a {
  323. color: $sidebar-dark-color;
  324. &:hover,
  325. &:focus {
  326. text-decoration: none;
  327. }
  328. }
  329. }
  330. // All submenus
  331. .nav-treeview {
  332. > .nav-item {
  333. > .nav-link {
  334. color: $sidebar-dark-submenu-color;
  335. &:hover,
  336. &:focus {
  337. background-color: $sidebar-dark-submenu-hover-bg;
  338. color: $sidebar-dark-submenu-hover-color;
  339. }
  340. }
  341. > .nav-link.active {
  342. &,
  343. &:hover,
  344. &:focus {
  345. background-color: $sidebar-dark-submenu-active-bg;
  346. color: $sidebar-dark-submenu-active-color;
  347. }
  348. }
  349. }
  350. }
  351. // Flat Style
  352. .nav-flat {
  353. .nav-item {
  354. .nav-treeview {
  355. .nav-treeview {
  356. border-color: $sidebar-dark-submenu-active-bg;
  357. }
  358. > .nav-item {
  359. > .nav-link {
  360. border-color: $sidebar-dark-submenu-active-bg;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. }
  367. // Sidebar variants
  368. @each $name, $color in $theme-colors {
  369. .sidebar-dark-#{$name},
  370. .sidebar-light-#{$name} {
  371. @include sidebar-color($color)
  372. }
  373. }
  374. @each $name, $color in $colors {
  375. .sidebar-dark-#{$name},
  376. .sidebar-light-#{$name} {
  377. @include sidebar-color($color)
  378. }
  379. }
  380. // Nav Flat
  381. .nav-flat {
  382. margin: 0 -$sidebar-padding-x;
  383. &.nav-child-indent {
  384. .nav-treeview {
  385. padding-left: 0 !important;
  386. .nav-treeview {
  387. border-left: .2rem solid;
  388. }
  389. }
  390. }
  391. .nav-item {
  392. > .nav-link {
  393. border-radius: 0;
  394. margin-bottom: 0;
  395. }
  396. }
  397. &.nav-sidebar > .nav-item {
  398. .nav-treeview,
  399. > .nav-treeview {
  400. background: rgba($white, .05);
  401. .nav-item {
  402. > .nav-link {
  403. border-left: .2rem solid;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. // Nav Compact
  410. .nav-compact {
  411. .nav-link,
  412. .nav-header {
  413. padding: ($nav-link-padding-y / 2) ($nav-link-padding-x / 2);
  414. }
  415. .nav-header:not(:first-of-type) {
  416. padding: ($nav-link-padding-y * 1.5) ($nav-link-padding-x / 2) ($nav-link-padding-y / 2);
  417. }
  418. .nav-link > .right,
  419. .nav-link > p > .right {
  420. top: .5rem;
  421. right: .5rem;
  422. &:nth-child(2) {
  423. right: 1.6rem;
  424. }
  425. }
  426. }
  427. // Sidebar Form Control
  428. [class*='sidebar-dark'] {
  429. .form-control-sidebar,
  430. .btn-sidebar {
  431. background: lighten($sidebar-dark-bg, 5%);
  432. border: 1px solid lighten($sidebar-dark-bg, 15%);
  433. color: lighten(color-yiq(lighten($sidebar-dark-bg, 5%)), 15%);
  434. }
  435. .form-control-sidebar:focus,
  436. .btn-sidebar:focus {
  437. border: 1px solid lighten($sidebar-dark-bg, 30%);
  438. }
  439. .btn-sidebar:hover {
  440. background: lighten($sidebar-dark-bg, 7.5%);
  441. }
  442. .btn-sidebar:focus {
  443. background: lighten($sidebar-dark-bg, 10%);
  444. }
  445. }
  446. [class*='sidebar-light'] {
  447. .form-control-sidebar,
  448. .btn-sidebar {
  449. background: darken($sidebar-light-bg, 5%);
  450. border: 1px solid darken($sidebar-light-bg, 15%);
  451. color: color-yiq(darken($sidebar-light-bg, 5%));
  452. }
  453. .form-control-sidebar:focus,
  454. .btn-sidebar:focus {
  455. border: 1px solid darken($sidebar-light-bg, 30%);
  456. }
  457. .btn-sidebar:hover {
  458. background: darken($sidebar-light-bg, 7.5%);
  459. }
  460. .btn-sidebar:focus {
  461. background: darken($sidebar-light-bg, 10%);
  462. }
  463. }