覆盖PostCSS中的嵌套类

时间:2019-06-20 16:17:14

标签: html css reactjs sass postcss

我有多个按钮,每个按钮都有一些特定的属性。事实是,对于.btn-ismall,它并没有改变我想要的填充方式。

我的代码:

.btn {
  box-shadow: 0 1px 1px 0 rgba(22, 29, 37, 0.10);
  border-radius: 1px;
  outline: 0;
  font-family: var(--main-font);
  font-size: 14px;
  border: none;
  color: white;
  text-align: center;
  line-height: 22px;
  min-height: 38px;
  padding: 8px 18px 8px 18px;
  cursor: pointer;

  &.btn-primary {
    border: none;
    background-color: #005cff;

    &:hover {
      background-color: #004cd4;
    }

    &:active {
      background-color: #0044be;
    }

    &:disabled {
      background-color: #7fadfd;
      cursor: no-drop;
    }
  }

  &.btn-secondary {
    background-color: white;
    color: var(--iron);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
    border: solid 1px var(--pigeon);

    &:hover {
      border: 1px;
      border-style: solid;
      border-color: #8d919b;
    }

    &:active {
      border-color: #757881;
    }

    &:disabled {
      background-color: var(--pigeon);
      color: #8d919b;
      border: none;
      cursor: no-drop;
    }
  }

  &.btn-icon {
    display: flex;
    justify-content: center;
    align-items: baseline;
    background-color: #d8dce6;
    border-radius: 1px;
    font-family: var(--main-font);
    font-size: 12px;
    color: var(--ink);
    line-height: 18px;

    &:hover {
      background-color: #cbd0dc;
    }

    &:active {
      background-color: #c0c4cf;
    }

    &:disabled {
      cursor: no-drop;
      background-color: #f5f5f5;
    }
  }

  &.btn-ismall {
    display: flex;
    justify-content: center;
    align-items: baseline;
    background-color: #d8dce6;
    border-radius: 1px;
    font-family: var(--main-font);
    font-size: 12px;
    color: var(--ink);
    line-height: 18px;
    padding: 4px 12px 4px 12px !important;
  }
}

0 个答案:

没有答案