_layout.scss 6.5 KB
Newer Older
C
codecalm 已提交
1 2 3 4 5 6
//sidenav
$sidenav-width: 16.25rem;
$sidenav-width-folded: 4rem;
$sidenav-bg: $white;
$sidenav-border-color: $border-color-alpha;
$sidenav-dark-bg: $dark;
C
codecalm 已提交
7
$sidenav-padding: 1.25rem;
C
codecalm 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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 70 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 100 101 102 103 104 105 106 107 108 109 110 111 112
$sidenav-breakpoint-show: 'sm';
$sidenav-breakpoint-folded: 'lg';
$sidenav-folded-item-height: 3.5rem;

@mixin sidebar-folded($breakpoint-folded) {
  @if $breakpoint-folded {

    @include media-breakpoint-down($breakpoint-folded) {
      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 {
              color: #fff;

              > 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;
            }

            >span {
              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;
      }

      .sidebar-nav-title {
        display: none;
      }
    }
  }
}

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

C
codecalm 已提交
113

C
codecalm 已提交
114 115 116
/**
Topnav
 */
C
codecalm 已提交
117 118 119 120 121
.topnav {
  border-bottom: 1px solid;
  background-color: $navbar-bg;
  border-color: $navbar-border-color;

C
codecalm 已提交
122 123 124 125
  @media print {
    display: none;
  }

C
codecalm 已提交
126 127 128 129
  .navbar {
    margin: 0;
    padding: 0;
    min-height: $navbar-height;
C
codecalm 已提交
130
  }
C
codecalm 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146

  .navbar-brand-logo {
    &-sm {
      display: none;
    }

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

      &-sm {
        display: block;
      }
    }
  }
C
codecalm 已提交
147 148
}

C
codecalm 已提交
149 150 151
/**
Topbar
 */
C
codecalm 已提交
152 153 154 155 156 157 158 159
.topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  padding: 0 .5rem;
  z-index: $zindex-sticky;
  min-height: $navbar-height;
C
codecalm 已提交
160

C
codecalm 已提交
161 162 163
  & + & {
    top: add($navbar-height, 1px);
  }
C
codecalm 已提交
164

C
codecalm 已提交
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
  & + & + & {
    top: add($navbar-height * 2, 2px);
  }

  .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;
    }
  }
}

.topbar-fixed {
  position: fixed;
  z-index: $zindex-fixed;
}

C
codecalm 已提交
190 191 192
/**
Wrapper
 */
C
codecalm 已提交
193 194 195 196 197 198
.wrapper {
  height: 100%;
  overflow: hidden;
  width: 100%;
}

C
codecalm 已提交
199 200 201
/**
Content
 */
C
codecalm 已提交
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
.content {
  overflow: hidden;
  min-height: 100vh;
  padding: 0 .5rem 0;

  .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 已提交
225 226 227 228
  @media print {
    padding-top: 0 !important;
  }

C
codecalm 已提交
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
  .topbar + & {
    padding-top: add($navbar-height, 1px);
  }

  .topbar + .topbar + & {
    padding-top: add($navbar-height * 2, 2px);
  }

  .topbar + .topbar + .topbar + & {
    padding-top: add($navbar-height * 3, 3px);
  }
}

/**
Sidebar
 */
.sidebar {
  width: $sidenav-width;
  position: fixed;
  z-index: $zindex-fixed;
C
codecalm 已提交
249
  padding: 0;
C
codecalm 已提交
250 251
  background: $sidenav-bg;
  box-shadow: inset -1px 0 $sidenav-border-color;
C
codecalm 已提交
252 253
  top: 0;
  bottom: 0;
C
codecalm 已提交
254 255
  display: flex;
  flex-direction: column;
C
codecalm 已提交
256

C
codecalm 已提交
257 258
  @include sidebar-folded($sidenav-breakpoint-folded);
  @include sidebar-show($sidenav-breakpoint-show);
C
codecalm 已提交
259 260 261 262 263
}

.sidebar-brand {
  display: block;
  text-align: center;
C
codecalm 已提交
264 265 266 267 268 269

  line-height: $navbar-height;
  width: $sidenav-width;
  position: fixed;
  top: 0;
  left: 0;
C
codecalm 已提交
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
}

.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 已提交
292 293 294 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 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
.sidebar-content {
  padding: $sidenav-padding;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  @include scrollbar(true);

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

/**
Sidebar menu
 */
.sidebar-nav {
  margin: (-$sidenav-padding) (-$sidenav-padding) $sidenav-padding;
  padding: 0;
  list-style: none;

  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;
    color: #fff;
  }

  &.active {
    opacity: 1;
    color: #fff;
    box-shadow: inset 3px 0 $primary;
    background-color: rgba(#fff, .01);
  }

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

  .badge {
    margin-left: auto;
  }
}

.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 已提交
372
.sidebar-dark {
C
codecalm 已提交
373
  background: $sidenav-dark-bg;
C
codecalm 已提交
374
  color: $text-muted;
C
codecalm 已提交
375
  box-shadow: none;
C
codecalm 已提交
376 377 378 379 380

  .sidebar-brand {
    filter: brightness(0) invert(1);
  }
}