index.less 5.5 KB
Newer Older
陈文彬 已提交
1 2 3 4 5 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 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 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 166 167 168 169 170 171 172 173 174 175 176 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
@import (reference) '../../../design/index.less';

.active-menu-style() {
  .ant-menu-item-selected,
  .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected {
    background: linear-gradient(
      118deg,
      rgba(@primary-color, 0.7),
      rgba(@primary-color, 1)
    ) !important;
    border-radius: 2px;
    box-shadow: 0 0 4px 1px rgba(@primary-color, 0.7);
  }
}

.basic-menu {
  &-wrap {
    height: 100%;
  }

  .menu-item-icon {
    vertical-align: text-top;
  }
  // 透明化背景
  &-bg__sidebar {
    background-color: transparent;
  }

  &-bg__sidebar-hor {
    &.ant-menu-horizontal {
      display: flex;
      border: 0;
      align-items: center;

      .basic-menu-item__level1 {
        margin-right: 2px;
      }

      &.ant-menu-light {
        .ant-menu-item {
          &.basic-menu-item__level1 {
            height: 46px;
            line-height: 46px;
          }
        }

        .ant-menu-item:hover,
        .ant-menu-submenu:hover,
        .ant-menu-item-active,
        .ant-menu-submenu-active,
        .ant-menu-item-open,
        .ant-menu-submenu-open,
        .ant-menu-item-selected,
        .ant-menu-submenu-selected {
          color: @primary-color;
          border-bottom: 3px solid @primary-color;
        }

        .ant-menu-item:hover,
        .ant-menu-item-active,
        .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
        .ant-menu-submenu-active,
        .ant-menu-submenu-title:hover {
          color: @primary-color;
          border-bottom: 3px solid @primary-color;
        }

        // 有子菜单
        .ant-menu-submenu {
          &:hover {
            border-bottom: 3px solid @primary-color;
          }

          &.ant-menu-selected,
          &.ant-menu-submenu-selected {
            border-bottom: 3px solid @primary-color;
          }
        }
      }

      &.ant-menu-dark {
        background: transparent;

        .ant-menu-item:hover,
        .ant-menu-item-active,
        .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
        .ant-menu-submenu-active,
        .ant-menu-submenu-title:hover {
          background: @top-menu-active-bg-color;
          border-radius: 6px 6px 0 0;
        }

        .basic-menu-item__level1 {
          &.ant-menu-item-selected,
          &.ant-menu-submenu-selected {
            background: @top-menu-active-bg-color;
            border-radius: 6px 6px 0 0;
          }
        }

        .ant-menu-item {
          &.basic-menu-item__level1 {
            height: @header-height;
            line-height: @header-height;
          }
        }
        // 有子菜单
        .ant-menu-submenu {
          &.basic-menu-item__level1,
          .ant-menu-submenu-title {
            height: @header-height;
            line-height: @header-height;
          }
        }
      }
    }
  }
  // 重置菜单项行高
  .ant-menu-item,
  .ant-menu-sub.ant-menu-inline > .ant-menu-item,
  .ant-menu-sub.ant-menu-inline > .ant-menu-submenu > .ant-menu-submenu-title {
    height: @app-menu-item-height;
    margin: 0;
    line-height: @app-menu-item-height;
  }

  &.ant-menu-dark:not(.basic-menu-bg__sidebar-hor) {
    .active-menu-style();
  }

  // 层级样式
  &.ant-menu-dark {
    .ant-menu-item {
      transition: unset;
    }

    .ant-menu-item.ant-menu-item-selected.basic-menu-menu-item__level1,
    .ant-menu-submenu-selected.basic-menu-menu-item__level1 {
      color: @white;
    }

    .basic-menu-item__level1 {
      margin-bottom: 0;

      &.top-active-menu {
        color: @white;
        background: @top-menu-active-bg-color;
        border-radius: 6px 6px 0 0;
      }
    }

    // 2级菜单

    .basic-menu-item__level2:not(.ant-menu-item-selected) {
      background-color: @sub-menu-item-dark-bg-color;
    }

    .basic-menu-item__level2 {
      margin-bottom: 0;
    }
    // 3级菜单
    .basic-menu-item__level3,
    .basic-menu__popup {
      margin-bottom: 0;
    }

    .basic-menu-item__level3:not(.ant-menu-item-selected) {
      background-color: @children-menu-item-dark-bg-color;
    }

    .ant-menu-submenu-title {
      height: @app-menu-item-height;
      margin: 0;
      line-height: @app-menu-item-height;
    }
  }

  &.ant-menu-light {
    .basic-menu-item__level1 {
      &.top-active-menu {
        color: @primary-color;
        border-bottom: 6px solid @primary-color;
      }
    }

    &:not(.ant-menu-horizontal) {
      .ant-menu-item-selected {
        background: fade(@primary-color, 18%);
      }
    }

    .ant-menu-item.ant-menu-item-selected.basic-menu-menu-item__level1,
    .ant-menu-submenu-selected.basic-menu-menu-item__level1 {
      color: @primary-color;
    }
  }

  // 关键字的颜色
  &__keyword {
    color: lighten(@primary-color, 20%);
  }

  // 激活的子菜单样式
  .ant-menu-item.ant-menu-item-selected {
    position: relative;
  }
}

// 触发器样式
.ant-layout-sider {
  &-dark {
    .ant-layout-sider-trigger {
      color: darken(@white, 25%);
      background: @trigger-dark-bg-color;

      &:hover {
        color: @white;
        background: @trigger-dark-hover-bg-color;
      }
    }
  }

  &-light {
    border-right: 1px solid rgba(221, 221, 221, 0.6);

    .ant-layout-sider-trigger {
      color: @text-color-base;
      background: @trigger-light-bg-color;

      &:hover {
        color: @text-color-base;
        background: @trigger-light-hover-bg-color;
      }
    }
  }
}

.ant-menu-dark {
  &.ant-menu-submenu-popup {
    > ul {
      background: @first-menu-item-dark-bg-color;
    }

    .active-menu-style();
  }
}