<template>
  <div
    class="container wow animate__animated animate__fadeInUp"
    v-if="url"
  >
    <div class="img">
      <img
        :src="url"
        v-if="url"
        width="100%"
        class="img"
        lazy
      />
      <img
        v-else
        src="@/assets/404_images/no-pic.png"
        alt=""
        width="100%"
        height="100%"
        class="img"
      />
    </div>
    <div class="desc">
      <span class="name">{{ title }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "CulturalRelicCard",
  props: {
    url: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
  },
  methods: {},
};
</script>

<style lang='scss' scoped>
$blue: #2069c4;
.container {
  border: 1px solid #f1f1f1;
  height: 300px;
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  &:hover {
    // img {
    //   transform: scale(1.2);
    // }
    .desc {
      background-color: $blue;
      color: #fff;
    }
  }
  .img {
    background-color: #f8f8f8;
    height: 240px;
    cursor: pointer;
    transition: all 0.5s ease;
    overflow: hidden;
    img {
      height: 100%;
      object-fit: contain;
      // width: auto;
    }
  }
  .desc {
    padding: 16px;
    display: flex;
    justify-content: center;
    transition: all 0.5s ease;
    flex: 1;
  }
  .showIcon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 99;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    height: 28px;
    padding: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    width: 28px;
    white-space: nowrap;
    overflow: hidden;
    &:hover {
      .icon {
        display: none;
      }
      .text {
        display: block;
      }
      width: 130px;
      padding: 4px 8px;
    }
    .icon {
      width: 20px;
      display: inline-block;
    }
    .text {
      font-size: 14px;
      color: #000;
      padding: 4px 8px;
      cursor: pointer;
      display: none;
    }
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>