<!--
* 名曲鉴赏 列表
-->
<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="highName">
        <EllipsisScroll :title="item.highName || ''" />
      </div>
      <div class="addBtn" @click.stop="emits('handleAdd', item)">添加</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% + 24px);
  margin-left: -24px;
  display: flex;
  flex-wrap: wrap;
  padding: 0 30px;
  .musicCon {
    width: calc(33.3333% - 24px);
    margin-left: 24px;
    margin-top: 24px;
    padding: 16px;
    display: flex;
    align-items: center;
    background: #f5f6fa;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    &:hover {
      border-color: #198cfe;
      transform: scale(1.02);
      transition: all 0.2s ease;
    }
    &:nth-child(-n + 3) {
      margin-top: 0;
    }
    .highName {
      overflow: hidden;
      flex-grow: 1;
      font-weight: 600;
      font-size: 15px;
      color: #131415;
      line-height: 21px;
      &::v-deep(.highlighted) {
        color: $themeColor;
      }
    }
    .avatar {
      flex-shrink: 0;
      width: 60px;
      height: 60px;
      border-radius: 7px;
      margin-right: 12px;
    }
    .addBtn {
      margin-left: 20px;
      flex-shrink: 0;
      font-weight: 600;
      font-size: 13px;
      color: #ffffff;
      line-height: 19px;
      padding: 4px 14px;
      background: #198cfe;
      border-radius: 4px;
      &:hover {
        opacity: 0.8;
      }
    }
  }
}
</style>
