Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
fix: Breadcrumb links for sub-categories
Browse files Browse the repository at this point in the history
Together with vtex/faststore#1148, there's no need of this `buildUrl` function. This function was actually building the wrong path for sub-categories (e.g. `/desk` instead of `/office/desk`).
  • Loading branch information
Filipe W. Lima committed Feb 11, 2022
1 parent 1fce620 commit 5aa41af
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/components/ui/Breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ export interface BreadcrumbProps extends UIBreadcrumbProps {
}

function Breadcrumb({ breadcrumbList }: BreadcrumbProps) {
const buildUrl = (url: string) => {
const parsedUrl = url.split('/')

return `/${parsedUrl[parsedUrl.length - 1]}`
}

return (
<UIBreadcrumb divider="">
<Link aria-label="home" to="/">
Expand All @@ -32,7 +26,7 @@ function Breadcrumb({ breadcrumbList }: BreadcrumbProps) {
return breadcrumbList.length === index + 1 ? (
<span key={String(index)}>{name}</span>
) : (
<Link to={buildUrl(item)} key={String(index)}>
<Link to={item} key={String(index)}>
{name}
</Link>
)
Expand Down

0 comments on commit 5aa41af

Please sign in to comment.