<template>
  <div class="sidebar-logo-container" :class="{'collapse':collapse}">
    <transition name="sidebarLogoFade">
      <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">{{ $t('route.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="sidebar-title">{{ $t('route.title') }}</h1>
      </router-link>
    </transition>
    <tips v-if="layoutWay==='topBottom'" class="tips-box" :bg-color-set="colorSet" />

  </div>
</template>

<script>
import { Tips } from '@/layout/components'
import { mapState } from 'vuex'
export default {
  name: 'SidebarLogo',
  components: {
    Tips
  },
  props: {
    collapse: {
      type: Boolean,
      required: true
    }
  },
  data() {
    return {
      logo: '',
      colorSet: {
        bgColor: 'none',
        imgColor: '#fff'
      }

    }
  },
  computed: {
    ...mapState({
      layoutWay: state => state.settings.layoutWay
    })
  }

}
</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: 50px;
  line-height: 50px;
  // background: #2b2f3a;
  background: #434a54;
  text-align: left;
  overflow: hidden;

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

    & .sidebar-logo {
      width: 32px;
      height: 32px;
      margin-right: 12px;
      margin-left: 20px;
      vertical-align: middle;
    }

    & .sidebar-title {
      display: inline-block;
      margin: 0 0 2px 12px;
      color: #fff;
      font-weight: 600;
      line-height: 50px;
      font-size: 14px;
      font-family: "Adobe-MyriadPro-Regular";
      vertical-align: middle;
    }
  }

  &.collapse {
    .sidebar-logo {
      margin-right: 0px;
    }
  }
}
.tips-box{
  float: right;
  z-index: 2000;
}
</style>
