_layout.scss 3.2 KB
Newer Older
C
codecalm 已提交
1 2 3 4
/**
Layout
 */
@mixin menu-side {
C
codecalm 已提交
5
  align-items: flex-start;
C
codecalm 已提交
6 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
}

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

C
codecalm 已提交
36 37 38 39 40
  .layout-toggler {
    display: block;
  }

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

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

.layout {
  position: relative;
  display: grid;
C
codecalm 已提交
55

C
codecalm 已提交
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
      .layout-toggler {
        display: none;
      }
C
codecalm 已提交
85 86

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

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

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

        .layout-area-menu {
C
codecalm 已提交
100 101 102 103 104 105 106
          width: $sidenav-folded-width;
        }
      }
    }
  }
}

C
codecalm 已提交
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
.layout-toggler {
  display: none;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  position: relative;
  opacity: .8;

  &-icon {
    top: 50%;
    left: 50%;
    display: block;
    margin-top: -2px;
    margin-left: -.75rem;

    transition-timing-function: cubic-bezier(.55, .055, .675, .19);
    transition-duration: 75ms;

    &,
    &:after,
    &:before {
      content: '';
      width: 1.5rem;
      height: 2px;
      background: currentColor;
      position: absolute;
      border-radius: 4px;
    }

    &:before {
      top: -.5rem;
      transition: top 75ms ease .12s, opacity 75ms ease;
    }

    &:after {
      bottom: -.5rem;
      transition: bottom 75ms ease .12s, transform 75ms cubic-bezier(.55, .055, .675, .19);
    }

    @at-root body.aside-visible & {
      transform: rotate(45deg);
      transition-delay: .12s;
      transition-timing-function: cubic-bezier(.215, .61, .355, 1);

      &:before {
        top: 0;
        transition: top 75ms ease, opacity 75ms ease .12s;
        opacity: 0;
      }

      &:after {
        bottom: 0;
        transition: bottom 75ms ease, transform 75ms cubic-bezier(.215, .61, .355, 1) .12s;
        transform: rotate(-90deg);
      }
    }
  }
}

C
codecalm 已提交
166 167
.layout-area-topnav {
  grid-area: head;
C
codecalm 已提交
168 169
  padding-left: 0;
  padding-right: 0;
C
codecalm 已提交
170 171
}

C
codecalm 已提交
172 173 174 175 176 177
.layout-area-menu {
  grid-area: menu;
}

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

C
codecalm 已提交
180 181
.layout-area-main {
  grid-area: main;
C
codecalm 已提交
182
}