<template>
  <div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
    <el-popover
      placement="right"
      popper-class='tooltips'
      visible-arrow="true"
      trigger="hover">
      <div>
        <!--<img :src="logo" class="tips_logo" />-->
        <div class="tips_title">{{title}}</div>
      </div>
      <transition name="sidebarLogoFade" slot="reference">
        <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
          <img v-if="logo" :src="logo" class="sidebar-logo" />
          <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
        </router-link>
        <router-link v-else key="expand" class="sidebar-logo-link" to="/">
          <img v-if="logo" :src="logo" class="sidebar-logo" />
          <h1 class="text-cl1 sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
        </router-link>
      </transition>
    </el-popover>
  </div>
</template>

<script>
import logoImg from '@/assets/images/logo/zjyj-logo.svg'
import variables from '@/assets/styles/variables.scss'

export default {
  name: 'SidebarLogo',
  props: {
    collapse: {
      type: Boolean,
      required: true
    }
  },
  computed: {
    variables() {
      return variables;
    },
    sideTheme() {
      return this.$store.state.settings.sideTheme
    }
  },
  data() {
    return {
      title: '重庆大司空信息科技有限公司',
      // logo: logoImg
      logo: ''
    }
  }
}
</script>

<style lang="scss" scoped>
.sidebarLogoFade-enter-active {
  transition: opacity 1.5s;
}

.sidebarLogoFade-enter,
.sidebarLogoFade-leave-to {
  opacity: 0;
}

.sidebar-logo-container {
  position: relative;
  width: 100%;
  height: 56px;
  line-height: 56px;
  background: #141b2f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  padding: 0px 18px;
  box-sizing: border-box;
  /*overflow: hidden;*/

  & .sidebar-logo-link {
    height: 100%;
    width: 100%;

    & .sidebar-logo {
      min-width: 22px;
      width: 22px;
      height: 22px;
      margin-right: 8px;
    }

    & .sidebar-title {
      margin: 0px;
      color: #fff;
      font-weight: 700;
      line-height: 22px;
      font-size: 14px;
      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
      vertical-align: middle;
    }
  }

  &.collapse {
    .sidebar-logo {
      margin-right: 0px;
    }
  }
}
.tooltips{

}
</style>
<style lang="scss">
  .tooltips.el-popover{
    min-width: 96px!important;
    width: 96px;
    padding: 0;
    .tips_logo{
      display: block;
      margin: 17px auto 8px;
    }
    .tips_title{
      font-family: MicrosoftYaHei-Regular, MicrosoftYaHei;
      color: #232323;
      line-height: 28px;
      width: 192px;
      font-size:22px;
      transform:scale(0.5);
      -webkit-transform:scale(0.5);
      padding: 16px 16px 0;
      float: left;
      margin-top: -14px;
      margin-left: -48px;
      text-align: center;
    }
  }
  .tooltips.el-popper {
    .popper__arrow{
    display: block !important;
    }
  }
  .tooltips.el-popper[x-placement^=right]{
    margin-left: 3px !important;
  }
</style>
