Logo.vue 2.4 KB

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