<template>
  <div class="logo">
    <!--    <img src="~@/assets/images/logo.png" alt="" :class="{ 'mr-2': !collapsed }" />-->
    <h2 v-show="!collapsed" :style="logoCSS"> {{ title }} </h2>
  </div>
</template>

<script lang="ts">
  import { useUserStoreWidthOut } from '@/store/modules/user';
  import { ref, computed } from 'vue';

  export default {
    name: 'Index',
    props: {
      collapsed: {
        type: Boolean,
      },
    },
    setup(_props) {
      const useUserStore = useUserStoreWidthOut();
      const title = ref(useUserStore.config.admin_web_title);
      const logoCSS = computed(() => {
        return useUserStore.config.mode === 'release'
          ? {
              color: `#e74d4d`,
              'font-size': `18px`,
              'font-weight': `bold`,
              'margin-bottom': `0`,
            }
          : {
              'font-size': `18px`,
              'font-weight': `bold`,
              'margin-bottom': `0`,
            };
      });

      return {
        title,
        logoCSS,
      };
    },
  };
</script>

<style lang="less" scoped>
  .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    line-height: 64px;
    overflow: hidden;
    white-space: nowrap;

    img {
      width: auto;
      height: 32px;
    }

    .title {
      margin-bottom: 0;
    }
  }
</style>
