<template>
  <div class="flow-container">
    <div class="flow">
      <div class="item" v-for="(item,index) in dataList" :key="index">
        <div class="top">
          <div :class="[item.active?'line':'dash-line',index===0?'item--hidden':'']"></div>
          <div :class="[item.active?'solid':'outline']">
            <span :class="{'sort--active':item.active,'sort':true}">{{index+1}}</span>
          </div>
          <div :class="[item.active?'line':'dash-line',index===dataList.length-1?'item--hidden':'']"></div>
        </div>
        <span :class="{'bottom--active':item.active,'bottom':true}">
          {{item.label}}
        </span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "flow",
    props: {
      dataList: {
        type: Array,
        default: []
      }
    },
    data() {
      return {}
    }
  }
</script>

<style lang="scss" scoped>
  $line-width1: 53px;
  $line-width2: 20px;

  .flow-container {
    display: flex;
    justify-content: center;
    width: 100%;
    height: 147px;
    box-shadow: 0px -0.5px 0px 0px rgba(0, 0, 0, 0.04) inset;

    .flow {
      display: flex;
      align-items: center;

      .item {
        display: flex;
        flex-direction: column;
        align-items: center;

        &--hidden {
          visibility: hidden;
        }

        .top {
          display: flex;
          align-items: center;

          .line {
            width: $line-width1;
            @media(max-width: 768px) {
              width: $line-width2;
            }
            height: 1px;
            border: 1px solid #308eff;
          }

          .dash-line {
            width: $line-width1;
            @media(max-width: 768px) {
              width: $line-width2;
            }
            height: 1px;
            border: 0.5px dashed #dedede;
          }

          .solid {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 28px;
            height: 28px;
            background: #308eff;
            border-radius: 50%;
          }

          .sort {
            font-size: 15px;
            font-family: PingFangSC, PingFangSC-Semibold, sans-serif;
            font-weight: 600;
            color: #666666;
            line-height: 21px;

            &--active {
              color: #ffffff;
            }
          }

          .outline {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 28px;
            height: 28px;
            background: #ffffff;
            border: 1px solid #dedede;
            border-radius: 50%;
          }
        }

        .bottom {
          margin-top: 5px;
          font-size: 13px;
          font-family: PingFangSC, PingFangSC-Semibold, sans-serif;
          font-weight: 600;
          color: #666666;
          line-height: 21px;

          &--active {
            color: #222222;
          }
        }
      }
    }
  }
</style>
