'Maintaining BEM for Variants in SCSS

Just wondering how this situation would be handled in BEM. I've written code for a card UI element in scss as follows.

<div class="card-custom">
<div class="card-custom__preview">
  <div class="card-custom__wrapper">
    <div class="card-custom__details">
      <h3>8 Days</h3>
      <h4><img src="" alt="" /> 24 JUN 2019 - 29 JUN 2020</h4>
    </div>
    <div class="card-custom__accordionbtn">
      <img src="" alt="" />
    </div>
  </div>
</div>
    .card-custom {
  max-width: 400px;
  border-radius: 4px;
  border: 1px solid rgba($grey, 0.3);
  margin: 0px 12px;
  background: rgba($grey, 0.2);
  position: relative;
  display: flex;
  flex-direction: column;
  background: white;

  &__details {
    margin-bottom: auto;
    h3 {
      font-size: 32px;
      margin-top: 8px;
      margin-bottom: 12px;
      color: white;
    }
    h4 {
      margin-top: 4px;
      font-size: 14px;
      font-weight: 400;
      margin-bottom: 16px;
      color: white;
      display: flex;
      align-items: center;

      img {
        margin-right: 8px;
        width: 16px;
        height: 16px;
      }
    }
  }

  &__value {
    font-size: 16px;
    font-weight: 400;
    margin-top: 8px;
    margin-bottom: 8px;
  }
}

Now if i wanted to have another variant of the card ( as per BEM it's card-custom--secondary ), how would i still be able to maintain nesting in scss for the child elements ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source