diff --git a/src/components/ui/breadcrumbs/Breadcrumbs.tsx b/src/components/ui/breadcrumbs/Breadcrumbs.tsx index 9937898ed..335627925 100644 --- a/src/components/ui/breadcrumbs/Breadcrumbs.tsx +++ b/src/components/ui/breadcrumbs/Breadcrumbs.tsx @@ -9,16 +9,11 @@ import PAGES_TITLES from '@/i18n/locales/fragments/schema/pagesTitles'; import capitalize from '@/lib/portable/str/capitalize'; import getPathParts from '@/lib/misc/getPathParts'; import { getServerSideI18n } from '@/i18n/server'; -import ROUTES_ROOTS from '##/config/routes'; import { i18ns } from '##/config/i18n'; -import { Fragment } from 'react'; -import HomepageCrumb from './custom/HomepageCrumb'; -import CrumbSeparator from './CrumbSeparator'; import Crumb from './Crumb'; interface BreadcrumbsProps { - withHomepageElement?: boolean; customCrumbs?: CustomCrumbs; className?: string; pathname: AppPath; @@ -27,7 +22,6 @@ interface BreadcrumbsProps { function crumbsGenerator( pathParts: string[], pagesTitlesParts: string[], - withHomepageElement: boolean, customCrumbsDepths: Index[] = [], customCrumbs?: CustomCrumbs ): ReactElement[] { @@ -38,14 +32,7 @@ function crumbsGenerator( return currentPath; } - const crumbs: ReactElement[] = withHomepageElement - ? [ - - - - - ] - : []; + const crumbs: ReactElement[] = []; function crumbGenerator(depth: Index, isLeaf: boolean, href: string) { // eslint-disable-next-line no-magic-numbers @@ -69,18 +56,10 @@ function crumbsGenerator( return crumbs; } -const Breadcrumbs: FunctionComponent = async ({ - withHomepageElement: maybeWithHomepageElement, - customCrumbs, - className, - pathname -}) => { +const Breadcrumbs: FunctionComponent = async ({ customCrumbs, className, pathname }) => { const globalT = await getServerSideI18n(); const customCrumbsDepths = customCrumbs?.map(({ depth }) => depth) ?? []; - const withHomepageElement = Boolean(maybeWithHomepageElement); - if (pathname === ROUTES_ROOTS.WEBSITE) return withHomepageElement ? : null; - const pathParts = getPathParts(pathname); const pagesTitlesParts = pathParts.reduce((acc, part, currentIndex) => { // eslint-disable-next-line no-magic-numbers @@ -99,7 +78,7 @@ const Breadcrumbs: FunctionComponent = async ({ return ( ); diff --git a/src/components/ui/breadcrumbs/Crumb.tsx b/src/components/ui/breadcrumbs/Crumb.tsx index 101898fd5..d996224c6 100644 --- a/src/components/ui/breadcrumbs/Crumb.tsx +++ b/src/components/ui/breadcrumbs/Crumb.tsx @@ -3,8 +3,6 @@ import type { FunctionComponent } from 'react'; import cn from '@/lib/portable/tailwind/cn'; import Link from 'next/link'; -import CrumbSeparator from './CrumbSeparator'; - interface CrumbProps { withRescueCtx?: boolean; isLeaf?: boolean; @@ -12,6 +10,12 @@ interface CrumbProps { href: string; } +const crumbSeparator = ( + +); + const Crumb: FunctionComponent = ({ isLeaf: maybeIsLeaf, label, href }) => { const isLeaf = Boolean(maybeIsLeaf); @@ -28,7 +32,7 @@ const Crumb: FunctionComponent = ({ isLeaf: maybeIsLeaf, label, href > {label} - {!isLeaf && } + {!isLeaf && crumbSeparator} ); }; diff --git a/src/components/ui/breadcrumbs/CrumbSeparator.tsx b/src/components/ui/breadcrumbs/CrumbSeparator.tsx deleted file mode 100644 index 0d27ca034..000000000 --- a/src/components/ui/breadcrumbs/CrumbSeparator.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import type { FunctionComponent } from 'react'; - -interface CrumbSeparatorProps {} - -const CrumbSeparator: FunctionComponent = () => ( - -); - -export default CrumbSeparator; diff --git a/src/components/ui/breadcrumbs/custom/HomepageCrumb.tsx b/src/components/ui/breadcrumbs/custom/HomepageCrumb.tsx deleted file mode 100644 index 953845304..000000000 --- a/src/components/ui/breadcrumbs/custom/HomepageCrumb.tsx +++ /dev/null @@ -1,24 +0,0 @@ -'use client'; - -import type { FunctionComponent } from 'react'; - -import { useScopedI18n } from '@/i18n/client'; -import ROUTES_ROOTS from '##/config/routes'; -import { i18ns } from '##/config/i18n'; - -import Crumb from '../Crumb'; - -interface HomepageCrumbProps { - isLeaf?: boolean; -} - -const HomepageCrumb: FunctionComponent = ({ isLeaf }) => { - const { pagesTitles } = i18ns; - const scopedT = useScopedI18n(pagesTitles); - const label = scopedT('homepage'); - const href = ROUTES_ROOTS.WEBSITE; - - return ; -}; - -export default HomepageCrumb;