<template>
  <div
    v-if="item"
    class="book-card2"
    @click="$router.push({ name: 'detail', params: { id: item.id } })"
  >
    <van-image
      class="book-card2__cover"
      fit="cover"
      :src="baseUrl + item.thumb"
      :width="122"
      :height="157"
    />

    <div class="book-card2-inner">
      <h3 class="limit-line">{{ item.name }}</h3>
      <div class="book-card2-inner__info">
        <p class="limit-line">{{ item.author }}</p>
        <p class="limit-line">{{ item.press }} 编</p>
      </div>
      <div class="book-card2-inner__read">
        <span>开始阅读</span>
        <van-icon name="arrow" />
      </div>
    </div>
  </div>
</template>

<script setup>
import { getBaseUrl } from "@/utils";

defineProps(["item"]);

const baseUrl = getBaseUrl();
</script>

<style lang="scss" scoped>
/* prettier-ignore */
.book-card2 {
  display: flex;
  align-items: center;
  gap: 48px;
  position: relative;
  margin: 30PX 40px 0;
  padding: 13PX 35px;
  height: 137PX;
  border-radius: 20px;
  box-shadow: 0px 0 20PX 0px rgba(153, 135, 110, 0.25);
  background: var(--van-white);
  box-sizing: border-box;

  &__cover {
    flex-shrink: 0;
    position: relative;
    bottom: 23PX;
  }
  &-inner {
    h3 {
      font-family: 'Source Han Serif CN-Bold';
    }
    p {
      font-size: 27px;
      color: var(--text-color-secondary);
    }
    &__info {
      margin: 20px 0 30px;
    }
    &__read {
      font-size: 27px;
      color:var(--van-primary-color);
      line-height: 20px;

      span {
        padding-right: 15px;
      }
    }
  }
}
</style>
