<script setup lang="ts">
import { ref, watch, computed } from "vue";
import { RouterView } from "vue-router";
import NavMenu from "@/components/NavMenu.vue";
import Logo from "@/components/LogoComponent.vue";
import { useSideBarStore } from "@/stores/side-bar";

const sideBarStore = useSideBarStore();

const brand = ref("技淘平台智慧产权大脑");

const collapsed = computed(() => sideBarStore.collapsed);

watch(
  () => sideBarStore.collapsed,
  (value: boolean) => {
    brand.value = value ? "大脑" : "技淘平台智慧产权大脑";
  }
);
</script>

<template>
  <a-layout class="layout">
    <a-layout-sider
      class="sider-nav-bar-wrap"
      width="260"
      theme="light"
      v-model:collapsed="sideBarStore.collapsed"
      collapsible
    >
      <div class="logo">
        <Transition name="slide-fade">
          <img src="@/assets/logo.png" width="50" v-if="collapsed" />
          <img src="@/assets/logo.png" width="120" v-else />
        </Transition>
      </div>
      <NavMenu class="sider-nav" />
    </a-layout-sider>
    <a-layout>
      <a-layout-content class="main-content">
        <RouterView />
      </a-layout-content>
    </a-layout>
  </a-layout>
</template>

<style scoped lang="scss">
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.2s ease;
}

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

.layout {
  background-color: #fff;
  .main-content {
    background-color: #fff;
    border-left: 1px solid #f3f3f3;
    min-width: 800px;
    padding: 20px 40px;
    padding-bottom: 60px;
  }

  .sider-nav-bar-wrap {
    height: 100vh;
    .logo {
      /* height: 32px; */
      margin: 16px;
      text-align: center;
    }
    .sider-nav {
      border-right: 0;
      padding-bottom: 50px;
    }
  }
}
</style>
