<template>
    <div class="sidebar-logo-container" :class="{ collapse: $state.collapse }"
        :style="{height: $state.navbar.height, lineHeight: $state.navbar.height}">
        <transition name="sidebarLogoFade">
            <RouterLink :key="$state.collapse ? `collapse` : `expand`" class="sidebar-logo-link"
                :to="$state.SiteInfo?.siteUrl">
                <img v-if="$state.SiteInfo?.logo" :src="$state.SiteInfo?.logo" class="sidebar-logo" />
                <h1 v-if="!$state.collapse" class="sidebar-title">{{ $state.SiteInfo?.title }}</h1>
            </RouterLink>
        </transition>
    </div>
</template>
<script setup>
// Logo部分 数据来源于 store.state
import { getState } from '../hooks'
const $state = getState();
</script>

<style>
.sidebarLogoFade-leave,
.sidebarLogoFade-enter-active {
    transition: opacity 1.5s;
}

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


.sidebar-logo-container {
    position: relative;
    width: 100%;
    background: #2b2f3a;
    text-align: center;
    overflow: hidden;
}

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

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

.sidebar-title {
    display: inline-block;
    margin: 0;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
    vertical-align: middle;
}

.collapse .sidebar-logo {
    margin-right: 0px;
}
</style>