<template>
<div class="folder">
  <div class="folder-icon">
    <img v-if="folder.img" :src="folder.img" alt=""/>
    <img v-else src="../../../static/img/folder_pic.png" alt=""/>
  </div>
  <p class="folder-name">{{ folder.name }}</p>
</div>
</template>
<script>
export default {
  name: 'folder-item',
  props: {
    folder: Object
  }
}
</script>
<style lang="scss" scoped>
.folder {
  width: 160px;
  margin-right: 10px;
  margin-bottom: 15px;
  border-radius: 2px;
  border: 1px solid #e4e7ed;
  .folder-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 138px;
    height: 138px;
    border: 10px solid #fff;
    background-color: #f5f5f8;
    img {
      vertical-align: middle;
      width: 80px;
      height: 80px;
    }
  }
  .folder-name {
    margin: 0;
    width: 100%;
    height: 37px;
    font-size: 14px;
    line-height: 37px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  &:hover .folder-name {
    background-color: #f0f2f5;
  }
}
</style>
