Logo.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="sidebar-logo-container" :class="{ 'collapse': collapse }" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
  3. <transition name="sidebarLogoFade">
  4. <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
  5. <img v-if="logo" :src="logo" class="sidebar-logo" />
  6. <h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
  7. </router-link>
  8. <router-link v-else key="expand" class="sidebar-logo-link" to="/">
  9. <img v-if="logo" :src="logo" class="sidebar-logo" />
  10. <h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
  11. </router-link>
  12. </transition>
  13. </div>
  14. </template>
  15. <script setup>
  16. import variables from '@/assets/styles/variables.module.scss'
  17. import logo from '@/assets/logo/logo.png'
  18. import useSettingsStore from '@/store/modules/settings'
  19. defineProps({
  20. collapse: {
  21. type: Boolean,
  22. required: true
  23. }
  24. })
  25. const title = import.meta.env.VITE_APP_TITLE;
  26. const settingsStore = useSettingsStore();
  27. const sideTheme = computed(() => settingsStore.sideTheme);
  28. </script>
  29. <style lang="scss" scoped>
  30. .sidebarLogoFade-enter-active {
  31. transition: opacity 1.5s;
  32. }
  33. .sidebarLogoFade-enter,
  34. .sidebarLogoFade-leave-to {
  35. opacity: 0;
  36. }
  37. .sidebar-logo-container {
  38. position: relative;
  39. width: 100%;
  40. height: 50px;
  41. line-height: 50px;
  42. background: #2b2f3a;
  43. text-align: center;
  44. overflow: hidden;
  45. & .sidebar-logo-link {
  46. height: 100%;
  47. width: 100%;
  48. & .sidebar-logo {
  49. width: 32px;
  50. height: 32px;
  51. vertical-align: middle;
  52. margin-right: 12px;
  53. }
  54. & .sidebar-title {
  55. display: inline-block;
  56. margin: 0;
  57. color: #fff;
  58. font-weight: 600;
  59. line-height: 50px;
  60. font-size: 14px;
  61. font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  62. vertical-align: middle;
  63. }
  64. }
  65. &.collapse {
  66. .sidebar-logo {
  67. margin-right: 0px;
  68. }
  69. }
  70. }
  71. </style>