BMC Chips

by Jens Kühn

HTML

<article>
  <div class="img-wrap">
    <img src="https://i.pravatar.cc/48" alt="" class="circle" />
  </div>
  <div class="details">
    <div class="title">Atul Kumar</div>
    <div class="caption">
      <dl>
        <dt class="bc"></dt>
        <dd>50</dd>
      </dl>

      <dl>
        <dt class="lc"></dt>
        <dd>LC</dd>
      </dl>

      <dl>
        <dt class="tc"></dt>
        <dd>TC</dd>
      </dl>

      <dl>
        <dt class="dt"></dt>
        <dd>DT</dd>
      </dl>
      
      <dl>
        <dt class="dl"></dt>
        <dd>B</dd>
      </dl>
    </div>
  </div>
</article>

<article class="dense">
  <div class="img-wrap">
    <img src="https://i.pravatar.cc/48" alt="" class="circle" />
  </div>
  <div class="details">
    <div class="title">Atul Kumar</div>
    <div class="caption">
      <dl>
        <dt class="bc"></dt>
        <dd>50</dd>
      </dl>

      <dl>
        <dt class="lc"></dt>
        <dd>LC</dd>
      </dl>

      <dl>
        <dt class="tc"></dt>
        <dd>TC</dd>
      </dl>

      <dl>
        <dt class="dt"></dt>
        <dd>DT</dd>
      </dl>
      
      <dl>
        <dt class="dl"></dt>
        <dd>B</dd>
      </dl>
    </div>
  </div>
</article>

SCSS

article {
  display: flex;
  align-items: center;
  position: relative;

  .img-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 8px;
  }

  .details {
    .title {
      font-size: 14px;
      font-weight: 700;
    }
    .caption {
      font-size: 12px;
      display: flex;
      gap: .25em;
    }
  }
  
  &.dense {
    .caption {
      gap: 0;
    }
    
    dl {
      border-radius: 0;
      border-left-width: 0;
    }
    
    dl:first-of-type {
      border-left-width: 1px;
      border-radius: .25em 0 0 .25em;
    }
    dl:last-of-type {
      border-radius: 0 .25em .25em 0;
    }
    
    dt {
      width: 1.25em;
    }
  
    dd {
      display: none;
    }
  }
}

dl {
  font-size: small;
  display: inline-flex;
  justify-content: center;
  gap: .5em;
  border: 1px solid rgba(37, 40, 46, 0.5);
  border-radius: .25em;
  padding: .075em .175em;
  margin: 0;
  
  dt {
    width: 1em;
    height: 1.25em;
    position: relative;
    
    &.bc::before {
      content: '🚂';
      position: absolute;
      top: -.125em;
      filter: sepia(60%);
    }
    &.lc::before {
      content: '\1F5F2';
      position: absolute;
      top: -.125em;
      color: goldenrod;
    }
    &.tc::before {
      content: '\26FD';
      position: absolute;
      top: -.125em;
    }
    &.dl::before {
      content: '\1F4B3';
      position: absolute;
      top: -.275em;
    }
    &.dt::before {
      content: '';
      position: absolute;
      display: inline-block; 
      left: -.25em;
      width: 1.5em;
      aspect-ratio: 3/4;
      color: goldenrod;
      background-image:...