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,22 +38,21 @@
38 <menu-unfold-outlined /> 38 <menu-unfold-outlined />
39 </button> 39 </button>
40 <div class="topbar-header-info"> 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 </div> 56 </div>
58 </div> 57 </div>
59 <div class="topbar-actions"> 58 <div class="topbar-actions">
@@ -151,6 +150,7 @@ import { @@ -151,6 +150,7 @@ import {
151 HomeOutlined, 150 HomeOutlined,
152 MenuFoldOutlined, 151 MenuFoldOutlined,
153 MenuUnfoldOutlined, 152 MenuUnfoldOutlined,
  153 + RightOutlined,
154 } from '@ant-design/icons-vue' 154 } from '@ant-design/icons-vue'
155 155
156 const router = useRouter() 156 const router = useRouter()
@@ -322,7 +322,6 @@ function handleLogout() { @@ -322,7 +322,6 @@ function handleLogout() {
322 322
323 .brand-copy strong, 323 .brand-copy strong,
324 .profile-copy strong, 324 .profile-copy strong,
325 -.topbar-header-info h1,  
326 .drawer-brand strong { 325 .drawer-brand strong {
327 font-family: 'Outfit', sans-serif; 326 font-family: 'Outfit', sans-serif;
328 color: var(--text-dark); 327 color: var(--text-dark);
@@ -418,12 +417,6 @@ function handleLogout() { @@ -418,12 +417,6 @@ function handleLogout() {
418 gap: 4px; 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 :deep(.custom-breadcrumb) { 420 :deep(.custom-breadcrumb) {
428 display: flex; 421 display: flex;
429 align-items: center; 422 align-items: center;
@@ -435,13 +428,37 @@ function handleLogout() { @@ -435,13 +428,37 @@ function handleLogout() {
435 align-items: center; 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 .bc-last { 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 .topbar-actions, 464 .topbar-actions,
@@ -592,9 +609,5 @@ function handleLogout() { @@ -592,9 +609,5 @@ function handleLogout() {
592 .soft-sider.collapsed { 609 .soft-sider.collapsed {
593 width: auto; 610 width: auto;
594 } 611 }
595 -  
596 - .topbar-header-info h1 {  
597 - font-size: 20px;  
598 - }  
599 } 612 }
600 </style> 613 </style>