_layout.scss 1.9 KB
Newer Older
C
codecalm 已提交
1 2 3
/**
Layout
 */
C
codecalm 已提交
4

C
codecalm 已提交
5
@mixin menu-side {
C
codecalm 已提交
6
  align-items: flex-start;
C
codecalm 已提交
7 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
}

@mixin menu-collapsed {
  .layout-area-menu {
    position: fixed;
    left: -($sidenav-width);
    top: 0;
    bottom: 0;
    background: $dark;
    color: $white;
    width: $sidenav-width;
    z-index: $zindex-fixed;
    transition: .3s left;

    @include menu-side;
  }

  .layout-area-menu-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100vw;
    background: rgba($dark, .1);
    z-index: $zindex-fixed - 1;
    visibility: hidden;
    opacity: 0;
  }

  @at-root body.menu-visible & {
    .layout-area-menu {
      left: 0;
    }
C
codecalm 已提交
41

C
codecalm 已提交
42 43 44 45 46 47
    .layout-area-menu-backdrop {
      opacity: 1;
      visibility: visible;
    }
  }
}
C
codecalm 已提交
48 49 50 51

.layout {
  position: relative;
  display: grid;
C
codecalm 已提交
52 53 54 55 56

  grid-template:
    "head" auto
    "menu" auto
    "main" auto /
C
codecalm 已提交
57
    100%;
C
codecalm 已提交
58 59
}

C
codecalm 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
.layout-collapsed {
  @each $breakpoint in map-keys($grid-breakpoints) {
    $infix: breakpoint-infix($breakpoint);

    @if $infix != '' {
      @include media-breakpoint-down($breakpoint) {

        &#{$infix} {
          @include menu-collapsed;
        }
      }
    } @else {
      @include menu-collapsed;
    }
  }
}

.layout-sidebar {
  @each $breakpoint in map-keys($grid-breakpoints) {
    $infix: breakpoint-infix($breakpoint);

    @include media-breakpoint-up($breakpoint) {
C
codecalm 已提交
82 83 84


      &#{$infix} {
C
codecalm 已提交
85 86 87 88 89 90
        grid-template:
          "menu head" auto
          "menu main" auto /
          auto 1fr;

        .layout-area-menu {
C
codecalm 已提交
91 92 93 94 95
          width: $sidenav-width;
        }
      }

      &-folded#{$infix} {
C
codecalm 已提交
96 97 98 99 100 101
        grid-template:
          "menu head" auto
          "menu main" auto /
          auto 1fr;

        .layout-area-menu {
C
codecalm 已提交
102
          width: $sidenav-folded-width;
C
codecalm 已提交
103

C
codecalm 已提交
104 105 106 107 108 109
        }
      }
    }
  }
}

C
codecalm 已提交
110 111
.layout-area-topnav {
  grid-area: head;
C
codecalm 已提交
112 113
}

C
codecalm 已提交
114 115 116 117 118 119
.layout-area-menu {
  grid-area: menu;
}

.layout-area-menu-backdrop {
  display: none;
C
codecalm 已提交
120 121
}

C
codecalm 已提交
122 123
.layout-area-main {
  grid-area: main;
C
codecalm 已提交
124
}