diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-08 11:12:20 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-08 11:12:20 +0700 |
| commit | d70ac2945e8755cbb63c60ad260d442e8f71ca74 (patch) | |
| tree | 5240e10268de9debff3123e5f68bfa9b6d21edf5 | |
| parent | 0f838908e3bd0410c504582be9bd0aed4b10bacc (diff) | |
<Miqdad> breadcrumb prod detail
| -rw-r--r-- | src-migrate/modules/product-detail/components/Breadcrumb.tsx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src-migrate/modules/product-detail/components/Breadcrumb.tsx b/src-migrate/modules/product-detail/components/Breadcrumb.tsx index a0f983d0..67aa12ab 100644 --- a/src-migrate/modules/product-detail/components/Breadcrumb.tsx +++ b/src-migrate/modules/product-detail/components/Breadcrumb.tsx @@ -19,6 +19,7 @@ const Breadcrumb = ({ id, name }: Props) => { const breadcrumbs = data ?? []; const total = breadcrumbs.length; const lastCat = total ? breadcrumbs[total - 1] : null; + const prevCat = total > 1 ? breadcrumbs[total - 2] : null; const hasHidden = total > 1; const hiddenText = hasHidden ? breadcrumbs @@ -36,16 +37,18 @@ const Breadcrumb = ({ id, name }: Props) => { </Link> ); - if (hasHidden) { + if (hasHidden && prevCat) { + // Jadikan ".." sebuah tautan ke kategori sebelumnya crumbsMobile.push( - <span + <Link + key='hidden' + href={createSlug('/shop/category/', prevCat.name, String(prevCat.id))} className='text-danger-500 shrink-0' title={hiddenText} - aria-label='Kategori tersembunyi' - key='hidden' + aria-label={`Kembali ke ${prevCat.name}`} > .. - </span> + </Link> ); } |
