<template>
  <div class="floor">
    <h3>F{{ floor.floorNumber }}&nbsp;{{ floor.name }}</h3>
    <ul class="list-unstyled clearfix" :style="{borderColor: floor.items[1].backGroundColor || '#d8d8d8'}">
      <li v-for="(item, index) in floor.items" :key="index" class="floor-item" :class="item.size"
          :style="{backgroundColor: item.backGroundColor || '#fff', borderColor: item.borderColor || floor.items[1].backGroundColor || '#d8d8d8'}">
        <a :href="item.hrefUrl" target="_blank">
          <img :src="item.pictureUrl" class="floor-item-img"/>
          <div class="floor-content">
            <p v-if="item.name" class="floor-item-name">{{ item.name }}</p>
            <p v-if="item.body" v-html="item.body" class="floor-item-body"></p>
          </div>
        </a>
      </li>
    </ul>
  </div>
</template>
<script>
  export default {
    name: 'floor',
    props: {
      floor: Object
    }
  }
</script>
<style lang="scss" scoped>
  .floor h3 {
    width: 100%;
    height: 70px;
    font-size: 24px;
    padding-top: 0;
    margin: 0;
    line-height: 100px;
    color: #333;
  }
  .floor {

    ul {
      border-bottom: 1px solid #d8d8d8;
    }

    .floor-item {
      float: left;
      position: relative;
      overflow: hidden;

      a {
        display: block;
        text-align: center;
      }

      .floor-item-img:hover {
        transform: scale(1.1);
      }

      .floor-content {
        position: absolute;
        text-align: center;
      }

      &.medium,&.small {
        border-top: 1px solid #d8d8d8;
        border-right: 1px solid #d8d8d8;
      }

      &.large {
        width: 360px;
        height: 400px;

        img {
          width: 226px;
          height: 226px;
          margin-top: 40px;
        }
      }
      &.medium {
        width: 390px;
        height: 200px;

        img {
          position: absolute;
          bottom: 50px;
          right: 52px;
          width: 100px;
          height: 100px;
        }

        .floor-content {
          top: 0;
          left: 0;
          right: 0;
          padding: 30px;
        }

        .floor-item-name {
          color: #575757;
          font-size: 24px;
          margin-bottom: 30px;
          text-align: left;
          font-weight: 600;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          width: 300px;
          word-wrap: break-word;
        }

        .floor-item-body {
          margin-right: 150px;
          color: #575757;
          font-size: 14px;
          line-height: 20px;
          text-align: left;
        }
      }
      &.small {
        width: 220px;
        height: 200px;

        img {
          margin-top: 15px;
          width: 70px;
          height: 70px;
        }

        .floor-content {
          top: 100px;
          bottom: 0;
          left: 0;
          right: 0;
          padding: 15px;
        }

        .floor-item-name {
          color: #575757;
          font-size: 16px;
          font-weight: 600;
          text-overflow: ellipsis;
          overflow: hidden;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          word-break: break-all;
          display: inherit;
        }

        .floor-item-body {
          color: #575757;
          font-size: 14px;
          line-height: 18px;
        }
      }
      &.tiny {
        display: none;
      }
    }
  }
</style>
