Commit 32f52c2c5ad178b6a2a0c93422c52d67ba7ef117

Authored by shaofan
1 parent 1ec56380

Refactor: Revamp breadcrumbs with transition effects and improved styling for be…

…tter usability and aesthetics.
Showing 1 changed file with 44 additions and 31 deletions
src/layouts/MainLayout.vue
... ... @@ -38,22 +38,21 @@
38 38 <menu-unfold-outlined />
39 39 </button>
40 40 <div class="topbar-header-info">
41   - <a-breadcrumb class="custom-breadcrumb" separator="/">
42   - <a-breadcrumb-item key="home">
43   - <router-link :to="auth.fallbackHomePath">
44   - <home-outlined />
45   - </router-link>
46   - </a-breadcrumb-item>
47   - <a-breadcrumb-item v-for="bc in breadcrumbs" :key="bc.code || bc.path || bc.name">
48   - <router-link v-if="bc.path && bc.path !== route.path" :to="bc.path">
49   - {{ bc.name }}
50   - </router-link>
51   - <span v-else :class="bc.path === route.path ? 'bc-last' : 'bc-parent'">
52   - {{ bc.name }}
53   - </span>
54   - </a-breadcrumb-item>
55   - </a-breadcrumb>
56   - <h1>{{ currentTitle }}</h1>
  41 + <transition name="breadcrumb-fade" mode="out-in">
  42 + <a-breadcrumb :key="route.path" class="custom-breadcrumb">
  43 + <template #separator>
  44 + <span class="bc-separator"><right-outlined /></span>
  45 + </template>
  46 + <a-breadcrumb-item v-for="(bc, idx) in breadcrumbs" :key="idx">
  47 + <router-link v-if="bc.path && bc.path !== route.path" :to="bc.path">
  48 + <span class="bc-parent">{{ bc.name }}</span>
  49 + </router-link>
  50 + <span v-else :class="idx === breadcrumbs.length - 1 ? 'bc-last' : 'bc-parent'">
  51 + {{ bc.name }}
  52 + </span>
  53 + </a-breadcrumb-item>
  54 + </a-breadcrumb>
  55 + </transition>
57 56 </div>
58 57 </div>
59 58 <div class="topbar-actions">
... ... @@ -151,6 +150,7 @@ import {
151 150 HomeOutlined,
152 151 MenuFoldOutlined,
153 152 MenuUnfoldOutlined,
  153 + RightOutlined,
154 154 } from '@ant-design/icons-vue'
155 155  
156 156 const router = useRouter()
... ... @@ -322,7 +322,6 @@ function handleLogout() {
322 322  
323 323 .brand-copy strong,
324 324 .profile-copy strong,
325   -.topbar-header-info h1,
326 325 .drawer-brand strong {
327 326 font-family: 'Outfit', sans-serif;
328 327 color: var(--text-dark);
... ... @@ -418,12 +417,6 @@ function handleLogout() {
418 417 gap: 4px;
419 418 }
420 419  
421   -.topbar-header-info h1 {
422   - margin: 0;
423   - font-size: 22px;
424   - line-height: 1.3;
425   -}
426   -
427 420 :deep(.custom-breadcrumb) {
428 421 display: flex;
429 422 align-items: center;
... ... @@ -435,13 +428,37 @@ function handleLogout() {
435 428 align-items: center;
436 429 }
437 430  
438   -.bc-parent,
439   -.bc-last {
440   - font-size: 13px;
  431 +.bc-separator {
  432 + font-size: 11px;
  433 + opacity: 0.6;
  434 + color: var(--text-soft);
  435 + margin: 0 4px;
  436 +}
  437 +
  438 +.bc-parent {
  439 + color: var(--text-soft) !important;
  440 + font-size: 14px;
441 441 }
442 442  
443 443 .bc-last {
444   - color: var(--text-dark);
  444 + font-size: 18px;
  445 + font-weight: 600;
  446 + color: var(--text-main) !important;
  447 + letter-spacing: 0.5px;
  448 +}
  449 +
  450 +/* Breadcrumb transition */
  451 +.breadcrumb-fade-enter-active,
  452 +.breadcrumb-fade-leave-active {
  453 + transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  454 +}
  455 +.breadcrumb-fade-enter-from {
  456 + opacity: 0;
  457 + transform: translateX(10px);
  458 +}
  459 +.breadcrumb-fade-leave-to {
  460 + opacity: 0;
  461 + transform: translateX(-10px);
445 462 }
446 463  
447 464 .topbar-actions,
... ... @@ -592,9 +609,5 @@ function handleLogout() {
592 609 .soft-sider.collapsed {
593 610 width: auto;
594 611 }
595   -
596   - .topbar-header-info h1 {
597   - font-size: 20px;
598   - }
599 612 }
600 613 </style>
... ...