<template>
  <view class="classmates">
    <view class="title">班级同学（共{{classmates.length}}人）</view>
    <view class="classmates-list">
      <view class="classmates-item" v-for="(item, index) in classmates" :key="index">
        <view class="classmates-item-avatar">
          <image :src="item.avatar"></image>
        </view>
        <view class="classmates-item-info-name">{{item.name}}</view>
      </view>
    </view>
  </view>
</template>

<script setup lang=ts>
defineProps<{
  classmates: {
    name: string;
    avatar: string;
  }[]
}>()
</script>

<style scoped lang="scss">
.classmates {
  background-color: #fff;
  border-radius: 20rpx;
  padding: 30rpx;
  margin-bottom: 30rpx;
  .title {
    font-size: 32rpx;
    line-height: 48rpx;
    font-weight: 500;
    margin-bottom: 37rpx;
  }
  .classmates-list {
    display: flex;
    gap: 20rpx;
    overflow-x: auto;
    padding-bottom: 12rpx;
    .classmates-item {
      width: 120rpx;
      .classmates-item-avatar {
        margin-bottom: 20rpx;
        text-align: center;
        image {
          width: 90rpx;
          height: 90rpx;
          border-radius: 50%;
        }
      }
      .classmates-item-info-name {
        text-align: center;
        font-size: 28rpx;
        color: #666;
        line-height: 38rpx;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
</style>
