<template>
  <n-card class="collect-box" @click="handleDetail">
    <template #cover>
      <div class="cover">
        <!-- <img :src="cover" /> -->
      </div>
    </template>
    <div class="info-line">
      <div class="title">{{ title }}</div>
    </div>
  </n-card>
</template>
<script setup>
import { useRouter } from "vue-router";

const router = useRouter();
defineOptions({
  name: "collect-box",
});

const props = defineProps({
  id: {
    type: [Number, String],
    default: () => NaN,
  },
  title: {
    type: [String, undefined],
    default: () => "",
  },
  cover: {
    type: [String, undefined],
    default: () => "",
  },
  time: {
    type: [String, undefined],
    default: () => "",
  },
});
const handleDetail = () => {
  if (props.id) {
    router.push('/collect-detail/' + props.id)
  }
};
</script>

<style>
.collect-box {
  --collect-box-remark-color: #9b9b9b;
  --collect-box-background: url("/img/collect-box-bg.png");
  --collect-box-title-font-size: 1.625rem;
  --collect-box-title-dot: url("/img/dot.png");
}
</style>
<style lang="scss" scoped>
.n-card.collect-box {
  padding: 0.625rem;
  --n-padding-left: 0 !important;
  --n-padding-bottom: 0 !important;
  background: #f5f5f5;
  box-shadow: 0rem .125rem .25rem 0rem rgba(46, 25, 16, 0.16);
  border-radius: 0.8125rem;
  padding: 0;
  cursor: pointer;
  .cover {
    background-color: #c1b2b2;
    overflow: hidden;
    min-height: 20.1875rem;
    width: 100%;
  }
  .title {
    font-size: var(--collect-box-title-font-size);
    margin: 0.9375rem;
    padding-left: 25px;
    position: relative;
    line-height: calc(var(--collect-box-title-font-size) * 2);
    text-overflow: ellipsis;
    word-break: break-all;
    max-height: calc(var(--collect-box-title-font-size) * 3 + 0.9375rem * 2);
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    &::before {
      content: " ";
      top: calc(var(--collect-box-title-font-size) / 2);
      left: 0;
      position: absolute;
      background-image: var(--collect-box-title-dot);
      background-size: 1.25rem 1.25rem;
      width: 1.25rem;
      height: 1.25rem;
      background-repeat: no-repeat;
      background-position: center left;
    }
  }
  .info-line {
    display: flex;
    flex-direction: column;
    .time-line {
      width: 100%;
      flex: 1;
      display: flex;
      justify-content: space-between;
      color: var(--collect-box-remark-color);
      .see-more {
        cursor: pointer;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        img {
          max-height: 1rem;
          width: auto;
          margin-left: 0.3125rem;
        }
      }
    }
  }
}
</style>
