fix(breadcrumb): remove first empty breadcrumb element

This commit is contained in:
RadoslavDimchev 2024-04-29 18:38:09 +03:00 committed by Emil Ivanichkov
parent 798af9d18a
commit a8ab123adf
1 changed files with 3 additions and 2 deletions

View File

@ -53,14 +53,15 @@ const routes = [
const Breadcrumb = () => {
const breadcrumbs = useBreadcrumbs(routes as BreadcrumbsRoute<string>[])
const slicedBreadcrumbs = breadcrumbs.slice(1)
return (
<XStack space={'$2'} alignItems="center">
{breadcrumbs.map(({ match, breadcrumb }, index) => (
{slicedBreadcrumbs.map(({ match, breadcrumb }, index) => (
<BreadcrumbElement
match={match}
breadcrumb={breadcrumb}
isLastElement={index === breadcrumbs.length - 1}
isLastElement={index === slicedBreadcrumbs.length - 1}
/>
))}
</XStack>