<template>
  <div class="groupPanel-component">
    <img :src="title" alt="" class="title" />
    <div class="groupPanel-list">
      <div class="group-item" v-for="group in groupList" :key="group.id">
        <div class="group-item-title">
          <img
            class="group-item-title-icon"
            src="@/assets/images/linkPrediction/title/group-item-title.png"
            alt=""
          />
          <div class="group-item-title-type">{{ group.type }}</div>
        </div>
        <div class="group-item-statistics">
          <div class="statistics-item" v-for="statistic in group.statistics" :key="statistic.id">
            <img :src="statistic.iconImg" alt="" class="sta-prefix" />
            <div class="statistics-content">
              <div class="sta-name">{{ statistic.name }}</div>
              <div class="sta-count">{{ statistic.value }}</div>
            </div>
          </div>
        </div>
        <div class="media-list" v-if="group.mediaList.length">
          <div class="media-item" v-for="media in group.mediaList" :key="media.id">
            <img :src="media.avatar" :alt="media.name" class="media-avatar" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from "vue";

const props = defineProps({
  groupList: {
    type: Array,
    default: () => []
  },
  title: {
    type: String,
    default: ""
  }
});
</script>

<style scoped lang="less">
.groupPanel-component {
  width: 100%;
  height: 100%;
  .title {
    margin-top: -7px;
    margin-left: -2px;
  }
  .groupPanel-list {
    width: 100%;
    height: 470px;
    padding: 20px 20px;
    overflow: auto;
    &::-webkit-scrollbar {
      width: 3px; /* 垂直滚动条宽度 */
      height: 5px; /* 水平滚动条高度 */
    }
    &::-webkit-scrollbar-thumb {
      background: rgba(147, 210, 255, 0.3); /* 蓝色半透明滑块 */
      border-radius: 4px;
    }
    &::-webkit-scrollbar-thumb:hover {
      background: rgba(147, 210, 255, 0.5); /* 更明显的蓝色 */
    }
    .group-item {
      width: 100%;
      padding-bottom: 20px;
      border-bottom: 0.5px solid rgba(0, 113, 188, 0.5);
      .group-item-title {
        position: relative;
        .group-item-title-type {
          position: absolute;
          top: 0;
          color: #8efbff;
          left: 17px;
          font-size: 14px;
        }
      }
      .group-item-statistics {
        width: 80%;
        height: 40px;
        display: flex;
        justify-content: space-between;
        margin-top: 20px;
        .statistics-item {
          display: flex;
          align-items: center;
          font-size: 14px;
          .sta-prefix {
            width: 32px;
            height: 32px;
          }
          .statistics-content {
            width: 150px;
            margin-left: 10px;
            color: #fff;
            .sta-count {
              font-family: MiSans;
              font-size: 18px;
              font-style: normal;
              font-weight: 700;
            }
          }
        }
      }
      .media-list {
        width: 100%;
        height: 54px;
        display: flex;
        margin-top: 20px;
        display: flex;
        justify-content: space-between;
        .media-item {
          width: 54px;
          height: 54px;
          overflow: hidden;
          .media-avatar {
            width: 100%;
            height: 100%;
            border-radius: 4px;
            cursor: pointer;
          }
        }
      }
    }
    .group-item:not(:first-child) {
      margin-top: 25px;
    }
  }
}
</style>
