<!--
* 音乐家 列表
-->
<template>
  <div class="musicListBox">
    <div class="musicCon" v-for="item in musicList" :key="item.id" @click="emits('handlePreview', item)">
      <img class="avatar" :src="item.avatar || icon_default" alt="" />
      <div class="addBtn" @click.stop="emits('handleAdd', item)">添加</div>
      <div class="highName">
        <EllipsisScroll :title="item.highName || ''" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import EllipsisScroll from "@/components/ellipsisScroll"
import icon_default from "../imgs/icon_default.png"

const props = defineProps<{
  musicList: any[]
}>()

const emits = defineEmits<{
  (event: "handlePreview", item: Record<string, any>): void
  (event: "handleAdd", item: Record<string, any>): void
}>()
</script>

<style lang="scss" scoped>
.musicListBox {
  width: calc(100% + 40px);
  margin-left: -40px;
  display: flex;
  flex-wrap: wrap;
  padding: 0 30px;
  .musicCon {
    width: calc(16.6666% - 40px);
    margin-left: 40px;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    &:nth-child(-n + 6) {
      margin-top: 0;
    }
    &:hover {
      .avatar {
        border-color: #198cfe;
        transform: scale(1.02);
        transition: all 0.2s ease;
      }
    }
    .highName {
      text-align: center;
      width: 100%;
      margin-top: 12px;
      overflow: hidden;
      font-weight: 600;
      font-size: 14px;
      color: #131415;
      line-height: 20px;
      &::v-deep(.highlighted) {
        color: $themeColor;
      }
    }
    .avatar {
      box-sizing: initial;
      border: 2px solid transparent;
      width: 140px;
      height: 160px;
      border-radius: 12px;
    }
    .addBtn {
      top: 8px;
      right: 8px;
      position: absolute;
      font-weight: 600;
      font-size: 12px;
      color: #ffffff;
      line-height: 18px;
      padding: 2px 10px;
      background: #198cfe;
      border-radius: 4px;
      &:hover {
        opacity: 0.8;
      }
    }
  }
}
</style>
