_main-sidebar.scss 7.6 KB
Newer Older
R
REJack 已提交
1 2 3
//
// Component: Main Sidebar
//
A
Abdullah Almsaeed 已提交
4 5 6 7

.main-sidebar {
  height: 100vh;
  overflow-y: hidden;
8
  z-index: $zindex-main-sidebar;
A
Abdullah Almsaeed 已提交
9 10 11
}

.sidebar {
12 13
  height: calc(100% - 4rem);
  overflow-y: auto;
A
Abdullah Almsaeed 已提交
14 15 16
  padding-bottom: $sidebar-padding-y;
  padding-left: $sidebar-padding-x;
  padding-right: $sidebar-padding-x;
17
  padding-top: $sidebar-padding-y;
A
Abdullah Almsaeed 已提交
18 19 20 21 22 23
}

// Sidebar user panel
.user-panel {
  position: relative;

24
  [class*='sidebar-dark'] & {
A
Abdullah Almsaeed 已提交
25 26 27
    border-bottom: 1px solid lighten($dark, 12%);
  }

28
  [class*='sidebar-light'] & {
A
Abdullah Almsaeed 已提交
29 30 31 32 33 34 35 36 37 38 39
    border-bottom: 1px solid $gray-300;
  }

  &,
  .info {
    overflow: hidden;
    white-space: nowrap;
  }

  .image {
    display: inline-block;
40
    padding-left: $nav-link-padding-x - .2;
A
Abdullah Almsaeed 已提交
41 42 43 44
  }

  img {
    height: auto;
45
    width: $sidebar-user-image-width;
A
Abdullah Almsaeed 已提交
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
  }

  .info {
    display: inline-block;
    padding: 5px 5px 5px 10px;
  }

  .status,
  .dropdown-menu {
    font-size: $font-size-sm;
  }
}

// Sidebar navigation menu
.nav-sidebar {
  // All levels
  .nav-item {
    > .nav-link {
R
REJack 已提交
64
      margin-bottom: .2rem;
65

A
Abdullah Almsaeed 已提交
66 67 68 69 70 71
      .right {
        @include transition(transform $transition-fn $transition-speed);
      }
    }
  }

R
REJack 已提交
72
  .nav-link > .right,
A
Abdullah Almsaeed 已提交
73 74 75
  .nav-link > p > .right {
    position: absolute;
    right: 1rem;
R
REJack 已提交
76 77 78 79 80 81
    top: .7rem;

    i,
    span {
      margin-left: .5rem;
    }
R
REJack 已提交
82 83

    &:nth-child(2) {
R
REJack 已提交
84
      right: 2.2rem;
R
REJack 已提交
85
    }
A
Abdullah Almsaeed 已提交
86 87 88 89 90 91 92 93
  }

  .menu-open {
    > .nav-treeview {
      display: block;
    }

    > .nav-link {
R
REJack 已提交
94
      i.right {
A
Abdullah Almsaeed 已提交
95 96 97 98 99 100 101 102 103 104 105 106
        @include rotate(-90deg);
      }
    }
  }

  // First Level
  > .nav-item {
    margin-bottom: 0;

    .nav-icon {
      font-size: 1.2rem;
      margin-right: .2rem;
R
REJack 已提交
107 108 109
      text-align: center;
      width: $sidebar-nav-icon-width;

R
REJack 已提交
110 111 112
      &.fa,
      &.fas,
      &.far,
113 114 115
      &.fab,
      &.glyphicon,
      &.ion {
R
REJack 已提交
116 117
        font-size: 1.1rem;
      }
A
Abdullah Almsaeed 已提交
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
    }

    .float-right {
      margin-top: 3px;
    }
  }

  // Tree view menu
  .nav-treeview {
    display: none;
    list-style: none;
    padding: 0;

    > .nav-item {
      > .nav-link {
        > .nav-icon {
          width: $sidebar-nav-icon-width;
        }
      }
    }
  }

R
REJack 已提交
140 141
  &.nav-child-indent {
    .nav-treeview {
142
      transition: padding $transition-speed $transition-fn;
143
      padding-left: 1rem;
144 145 146
    }
  }

A
Abdullah Almsaeed 已提交
147 148 149 150 151
  .nav-header {
    font-size: .9rem;
    padding: $nav-link-padding-y;

    &:not(:first-of-type) {
R
REJack 已提交
152
      padding: 1.7rem 1rem .5rem;
A
Abdullah Almsaeed 已提交
153 154 155 156 157 158 159 160 161 162
    }
  }

  .nav-link p {
    display: inline-block;
    margin: 0;
  }
}

#sidebar-overlay {
R
REJack 已提交
163 164 165 166 167 168
  @include media-breakpoint-down(md) {
    .sidebar-open & {
      display: block;
    }
  }

169
  background-color: rgba($black, 0.1);
A
Abdullah Almsaeed 已提交
170 171
  bottom: 0;
  display: none;
172 173 174 175
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
A
Abdullah Almsaeed 已提交
176
  z-index: $zindex-main-sidebar - 1;
R
REJack 已提交
177
}
A
Abdullah Almsaeed 已提交
178

R
REJack 已提交
179 180 181 182 183 184 185 186 187
.sidebar-mini-md {
  &.sidebar-open {
    #sidebar-overlay {
      @include media-breakpoint-up(sm) {
        display: none;
      }
      @include media-breakpoint-down(sm) {
        display: block;
      }
A
Abdullah Almsaeed 已提交
188 189 190 191
    }
  }
}

R
REJack 已提交
192 193 194 195 196 197 198 199
[class*='sidebar-light-'] {
  // Sidebar background color
  background-color: $sidebar-light-bg;

  // User Panel (resides in the sidebar)
  .user-panel {
    a:hover {
      color: $sidebar-light-hover-color;
R
REJack 已提交
200
    }
R
REJack 已提交
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220

    .status {
      background: $sidebar-light-hover-bg;
      color: $sidebar-light-color;

      &:hover,
      &:focus,
      &:active {
        background: darken($sidebar-light-hover-bg, 3%);
        color: $sidebar-light-hover-color;
      }
    }

    .dropdown-menu {
      @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
      border-color: darken($sidebar-light-hover-bg, 5%);
    }

    .dropdown-item {
      color: $body-color;
R
REJack 已提交
221 222 223
    }
  }

R
REJack 已提交
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
  // Sidebar Menu. First level links
  .nav-sidebar > .nav-item {
    // links
    > .nav-link {
      // border-left: 3px solid transparent;
      &:active,
      &:focus {
        color: $sidebar-light-color;
      }
    }

    // Hover and active states
    &.menu-open > .nav-link,
    &:hover > .nav-link {
      background-color: $sidebar-light-hover-bg;
      color: $sidebar-light-hover-color;
    }
R
REJack 已提交
241

R
REJack 已提交
242 243 244 245 246 247 248 249 250 251 252 253
    > .nav-link.active {
      color: $sidebar-light-active-color;

      @if $enable-shadows {
        @extend .elevation-1;
      }
    }

    // First Level Submenu
    > .nav-treeview {
      background: $sidebar-light-submenu-bg;
    }
A
Abdullah Almsaeed 已提交
254 255
  }

R
REJack 已提交
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
  // Section Heading
  .nav-header {
    background: inherit;
    color: darken($sidebar-light-color, 5%);
  }

  // All links within the sidebar menu
  .sidebar {
    a {
      color: $sidebar-light-color;

      &:hover {
        text-decoration: none;
      }
    }
  }

  // All submenus
  .nav-treeview {
    > .nav-item {
      > .nav-link {
        color: $sidebar-light-submenu-color;
      }

      > .nav-link.active {
        &,
        &:hover {
          background-color: $sidebar-light-submenu-active-bg;
          color: $sidebar-light-submenu-active-color;
        }
      }

      > .nav-link:hover {
        background-color: $sidebar-light-submenu-hover-bg;
      }
    }
A
Abdullah Almsaeed 已提交
292 293 294
  }
}

R
REJack 已提交
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
[class*='sidebar-dark-'] {
  // Sidebar background color
  background-color: $sidebar-dark-bg;

  // User Panel (resides in the sidebar)
  .user-panel {
    a:hover {
      color: $sidebar-dark-hover-color;
    }

    .status {
      background: $sidebar-dark-hover-bg;
      color: $sidebar-dark-color;

      &:hover,
      &:focus,
      &:active {
        background: darken($sidebar-dark-hover-bg, 3%);
        color: $sidebar-dark-hover-color;
      }
    }

    .dropdown-menu {
      @include box-shadow(0 2px 4px rgba(0, 0, 0, .4));
      border-color: darken($sidebar-dark-hover-bg, 5%);
    }

    .dropdown-item {
      color: $body-color;
    }
  }

  // Sidebar Menu. First level links
  .nav-sidebar > .nav-item {
    // links
    > .nav-link {
      // border-left: 3px solid transparent;
      &:active {
        color: $sidebar-dark-color;
      }
    }

    // Hover and active states
    &.menu-open > .nav-link,
    &:hover > .nav-link,
    & > .nav-link:focus  {
      background-color: $sidebar-dark-hover-bg;
      color: $sidebar-dark-hover-color;
    }

    > .nav-link.active {
      color: $sidebar-dark-hover-color;

      @if $enable-shadows {
        @extend .elevation-1;
      }
    }

    // First Level Submenu
    > .nav-treeview {
      background: $sidebar-dark-submenu-bg;
    }
R
REJack 已提交
357 358
  }

R
REJack 已提交
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
  // Section Heading
  .nav-header {
    background: inherit; //darken($sidebar-dark-bg, 3%);
    color: lighten($sidebar-dark-color, 5%);
  }

  // All links within the sidebar menu
  .sidebar {
    a {
      color: $sidebar-dark-color;

      &:hover,
      &:focus {
        text-decoration: none;
      }
    }
  }

  // All submenus
  .nav-treeview {
    > .nav-item {
      > .nav-link {
        color: $sidebar-dark-submenu-color;

        &:hover,
        &:focus {
          background-color: $sidebar-dark-submenu-hover-bg;
          color: $sidebar-dark-submenu-hover-color;
        }
      }

      > .nav-link.active {
        &,
        &:hover,
        &:focus {
          background-color: $sidebar-dark-submenu-active-bg;
          color: $sidebar-dark-submenu-active-color;
        }
      }
    }
  }
}

// Sidebar variants
@each $name, $color in $theme-colors {
  .sidebar-dark-#{$name},
R
REJack 已提交
405
  .sidebar-light-#{$name} {
R
REJack 已提交
406
    @include sidebar-color($color)
R
REJack 已提交
407 408 409
  }
}

R
REJack 已提交
410 411 412 413 414 415
@each $name, $color in $colors {
  .sidebar-dark-#{$name},
  .sidebar-light-#{$name} {
    @include sidebar-color($color)
  }
}
A
Abdullah Almsaeed 已提交
416

R
REJack 已提交
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438

// Nav Compact
.nav-compact {
  .nav-link,
  .nav-header {
    padding: ($nav-link-padding-y / 2) ($nav-link-padding-x / 2);
  }

  .nav-header:not(:first-of-type) {
    padding: ($nav-link-padding-y * 1.5) ($nav-link-padding-x / 2) ($nav-link-padding-y / 2);
  }

  .nav-link > .right,
  .nav-link > p > .right {
    top: .5rem;
    right: .5rem;

    &:nth-child(2) {
      right: 1.6rem;
    }
  }
}