_layout.scss 7.6 KB
Newer Older
C
codecalm 已提交
1
//sidenav
C
codecalm 已提交
2
$sidenav-width: 16rem;
C
codecalm 已提交
3 4
$sidenav-width-folded: 4rem;
$sidenav-bg: $white;
C
codecalm 已提交
5
$sidenav-border-color: $border-color;
C
codecalm 已提交
6
$sidenav-dark-bg: $dark;
C
codecalm 已提交
7
$sidenav-padding: 1.25rem;
C
codecalm 已提交
8 9 10 11
$sidenav-breakpoint-show: 'sm';
$sidenav-breakpoint-folded: 'lg';
$sidenav-folded-item-height: 3.5rem;

C
codecalm 已提交
12
@mixin sidebar-folded($breakpoint-folded, $breakpoint-show: false) {
C
codecalm 已提交
13 14
  @if $breakpoint-folded {

C
codecalm 已提交
15
    @include media-breakpoint-between($breakpoint-show, $breakpoint-folded) {
C
codecalm 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
      width: $sidenav-width-folded;

      .sidebar-brand {
        width: $sidenav-width-folded;
      }

      .sidebar-content {
        padding: 0;
        overflow: visible;
      }

      .sidebar-nav {
        margin: 0;

        > .sidebar-nav-item {
          position: relative;
          white-space: nowrap;

          &:hover {
            background: $primary;
            width: $sidenav-width;

            > .sidebar-nav-link {
C
codecalm 已提交
39
              color: #ffffff;
C
codecalm 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

              > span {
                display: block;
              }

              .icon {
                margin-right: add(1rem, $sidenav-padding);
              }
            }

            .sidebar-subnav {
              display: block;

              .sidebar-nav-link {
                padding-left: $sidenav-padding;
              }
            }
          }

          > .sidebar-nav-link {
            min-height: $sidenav-folded-item-height;
            padding: 0 1rem !important;
            position: relative;

            .icon {
              margin: 0;
              width: 2rem;
              height: 1.125rem;
            }

C
codecalm 已提交
70
            > span {
C
codecalm 已提交
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
              display: none;
            }

            .badge {
              display: block;
              position: absolute;
              left: 2.5rem;
              top: 1rem;

              text-indent: -99999px;
              width: $badge-empty-size;
              height: $badge-empty-size;
              padding: 0;
            }
          }
        }
      }

      .sidebar-subnav {
        display: none;
        position: absolute;
        top: $sidenav-folded-item-height;
        left: $sidenav-width-folded;
        right: 0;
        padding: .5rem 0;
        background: $dark;
        box-shadow: -6px 0px 16px -10px rgba(0, 0, 0, 0.2), $box-shadow;
      }

C
codecalm 已提交
100 101 102 103
      .sidebar-nav-arrow {
        display: none !important;
      }

C
codecalm 已提交
104 105 106
      .sidebar-nav-title {
        display: none;
      }
C
codecalm 已提交
107 108 109 110

      .hide-sidebar-folded {
        display: none !important
      }
C
codecalm 已提交
111 112 113 114 115 116 117 118 119 120
    }
  }
}

@mixin sidebar-show($breakpoint-show) {
  @include media-breakpoint-down($breakpoint-show) {
    display: none;
  }
}

C
codecalm 已提交
121

C
codecalm 已提交
122
/**
C
codecalm 已提交
123
Top nav
C
codecalm 已提交
124
 */
C
codecalm 已提交
125 126 127 128
.topnav {
  border-bottom: 1px solid;
  background-color: $navbar-bg;
  border-color: $navbar-border-color;
C
codecalm 已提交
129 130 131
  position: absolute;
  top: 0;
  left: 0;
C
codecalm 已提交
132
  width: 100vw;
C
codecalm 已提交
133 134 135
  padding: 0 .5rem;
  z-index: $zindex-sticky;
  min-height: $navbar-height;
C
codecalm 已提交
136
  user-select: none;
C
codecalm 已提交
137 138 139

  & + & {
    top: add($navbar-height, 1px);
C
codecalm 已提交
140
    z-index: $zindex-sticky - 1;
C
codecalm 已提交
141 142 143 144
  }

  & + & + & {
    top: add($navbar-height * 2, 2px);
C
codecalm 已提交
145
    z-index: $zindex-sticky - 2;
C
codecalm 已提交
146
  }
C
codecalm 已提交
147

C
codecalm 已提交
148 149 150 151
  @media print {
    display: none;
  }

C
codecalm 已提交
152 153 154 155
  .navbar {
    margin: 0;
    padding: 0;
    min-height: $navbar-height;
C
codecalm 已提交
156
  }
C
codecalm 已提交
157

C
codecalm 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
  .nav-link {
    height: $navbar-height;
  }

  .nav-item {
    &.active {
      position: relative;

      &:after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 2px;
        right: 2px;
        border-bottom: 1px solid $primary;
      }
    }
  }

C
codecalm 已提交
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
  .navbar-brand-logo {
    &-sm {
      display: none;
    }

    @include media-breakpoint-down($sidenav-breakpoint-show) {
      &-lg {
        display: none;
      }

      &-sm {
        display: block;
      }
    }
  }

  .sidebar + .content & {
    left: $sidenav-width;

    @if $sidenav-breakpoint-folded {
      @include media-breakpoint-down($sidenav-breakpoint-folded) {
        left: $sidenav-width-folded;
      }
    }

    @include media-breakpoint-down($sidenav-breakpoint-show) {
      left: 0;
      padding: 0;
    }
  }
}

C
codecalm 已提交
209
.topnav-fixed {
C
codecalm 已提交
210 211 212 213
  position: fixed;
  z-index: $zindex-fixed;
}

C
codecalm 已提交
214 215 216
/**
Wrapper
 */
C
codecalm 已提交
217 218 219 220 221 222
.wrapper {
  height: 100%;
  overflow: hidden;
  width: 100%;
}

C
codecalm 已提交
223 224 225
/**
Content
 */
C
codecalm 已提交
226 227 228 229
.content {
  overflow: hidden;
  min-height: 100vh;
  padding: 0 .5rem 0;
C
codecalm 已提交
230 231
  display: flex;
  flex-direction: column;
C
codecalm 已提交
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250

  .sidebar + & {
    margin-left: $sidenav-width;

    @if $sidenav-breakpoint-folded {
      @include media-breakpoint-down($sidenav-breakpoint-folded) {
        margin-left: $sidenav-width-folded;
      }
    }

    @include media-breakpoint-down($sidenav-breakpoint-show) {
      margin-left: 0;
      padding-left: 0;
      padding-right: 0;
    }
  }
}

.content-page {
C
codecalm 已提交
251 252 253
  flex: 1;
  display: flex;

C
codecalm 已提交
254 255 256 257
  @media print {
    padding-top: 0 !important;
  }

C
codecalm 已提交
258
  .topnav + & {
C
codecalm 已提交
259 260 261
    padding-top: add($navbar-height, 1px);
  }

C
codecalm 已提交
262
  .topnav + .topnav + & {
C
codecalm 已提交
263 264 265
    padding-top: add($navbar-height * 2, 2px);
  }

C
codecalm 已提交
266
  .topnav + .topnav + .topnav + & {
C
codecalm 已提交
267 268 269 270 271 272 273 274 275 276 277
    padding-top: add($navbar-height * 3, 3px);
  }
}

/**
Sidebar
 */
.sidebar {
  width: $sidenav-width;
  position: fixed;
  z-index: $zindex-fixed;
C
codecalm 已提交
278
  padding: 0;
C
codecalm 已提交
279 280
  background: $sidenav-bg;
  box-shadow: inset -1px 0 $sidenav-border-color;
C
codecalm 已提交
281 282
  top: 0;
  bottom: 0;
C
codecalm 已提交
283 284
  display: flex;
  flex-direction: column;
C
codecalm 已提交
285

C
codecalm 已提交
286
  @include sidebar-folded($sidenav-breakpoint-folded, $sidenav-breakpoint-show);
C
codecalm 已提交
287
  @include sidebar-show($sidenav-breakpoint-show);
C
codecalm 已提交
288 289 290 291 292
}

.sidebar-brand {
  display: block;
  text-align: center;
C
codecalm 已提交
293 294 295

  line-height: $navbar-height;
  width: $sidenav-width;
C
codecalm 已提交
296
  position: absolute;
C
codecalm 已提交
297 298
  top: 0;
  left: 0;
C
codecalm 已提交
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
}

.sidebar-brand-logo {
  height: 2rem;

  &-sm {
    display: none;
  }

  @if $sidenav-breakpoint-folded {
    @include media-breakpoint-down($sidenav-breakpoint-folded) {
      &-sm {
        display: inline-block;
      }

      &-lg {
        display: none;
      }
    }
  }
}

C
codecalm 已提交
321 322 323 324 325
.sidebar-content {
  padding: $sidenav-padding;
  flex: 1;
  display: flex;
  flex-direction: column;
C
codecalm 已提交
326
  overflow-y: scroll;
C
codecalm 已提交
327
  @include scrollbar;
C
codecalm 已提交
328 329 330 331 332 333 334 335 336 337 338 339 340

  .sidebar-brand + & {
    margin-top: $navbar-height;
  }
}

/**
Sidebar menu
 */
.sidebar-nav {
  margin: (-$sidenav-padding) (-$sidenav-padding) $sidenav-padding;
  padding: 0;
  list-style: none;
C
codecalm 已提交
341
  user-select: none;
C
codecalm 已提交
342
  color: $text-muted;
C
codecalm 已提交
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
}

.sidebar-nav-link {
  padding: .5rem $sidenav-padding;
  transition: .3s color, .3s background-color;
  color: inherit;
  display: flex;
  align-items: center;

  .sidebar-nav-item .sidebar-nav-item & {
    padding-left: add(1.5rem, $sidenav-padding);
  }

  .sidebar-nav-item .sidebar-nav-item .sidebar-nav-item & {
    padding-left: add(3rem, $sidenav-padding);
  }

  &:hover {
    background-color: rgba(#fff, .02);
    text-decoration: none;
C
codecalm 已提交
369
    color: $body-color !important;
C
codecalm 已提交
370
    cursor: pointer !important;
C
codecalm 已提交
371 372 373 374
  }

  &.active {
    opacity: 1;
C
codecalm 已提交
375
    color: $body-color !important;
C
codecalm 已提交
376 377 378 379 380 381 382 383 384 385 386 387 388 389
    box-shadow: inset 3px 0 $primary;
    background-color: rgba(#fff, .01);
  }

  .icon {
    width: 1rem;
    margin-right: .5rem;
  }

  .badge {
    margin-left: auto;
  }
}

C
codecalm 已提交
390 391
.sidebar-nav-arrow {
  display: block;
C
codecalm 已提交
392

C
codecalm 已提交
393 394
  margin-left: auto;
  @include caret(right);
C
codecalm 已提交
395

C
codecalm 已提交
396 397 398 399
  &:after {
    transition: .3s transform;
  }

C
codecalm 已提交
400 401 402
  .sidebar-nav-link[aria-expanded="true"] &:after {
    transform: rotate(-45deg);
  }
C
codecalm 已提交
403 404 405 406 407
}

.sidebar-subnav {
}

C
codecalm 已提交
408 409 410 411 412 413 414 415 416 417 418 419 420 421
.sidebar-nav-title {
  @include subheader(false);
  color: inherit;
  opacity: .8;
  padding: $sidenav-padding $sidenav-padding .5rem;

  &:not(:first-child) {
    margin-top: .5rem;
  }
}

/**
Sidebar dark
 */
C
codecalm 已提交
422
.sidebar-dark {
C
codecalm 已提交
423
  background: $sidenav-dark-bg;
C
codecalm 已提交
424
  color: $text-muted;
C
codecalm 已提交
425
  box-shadow: none;
C
codecalm 已提交
426 427 428 429

  .sidebar-brand {
    filter: brightness(0) invert(1);
  }
C
codecalm 已提交
430 431 432 433 434 435 436 437 438 439 440

  .sidebar-nav-link {
    &:hover,
    &.active {
      color: $white !important;
    }
  }

  .sidebar-content {
    @include scrollbar(true);
  }
C
codecalm 已提交
441
}