front_gestalt/components/breadcrumb.tsx

37 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2025-01-09 00:40:28 +03:00
"use client";
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import React from 'react';
const Breadcrumbs: React.FC = () => {
const pathname = usePathname();
const pathSegments = pathname.split('/').filter(segment => segment);
const correctName = {
events: "мероприятия сообщества",
2025-01-14 18:28:14 +03:00
"event-1": "базовая программа подготовки гештальт-терапевтов - добор",
2025-01-09 00:40:28 +03:00
participants: "участники",
2025-01-14 18:28:14 +03:00
1: "кириллов кирилл кириллович"
2025-01-09 00:40:28 +03:00
}
return(
2025-01-27 22:42:23 +03:00
<nav className="max-w-[1083px] px-[25px] mx-auto">
<ol className="flex flex-wrap text-middleGrey font-[350] my-[50px]">
2025-01-09 00:40:28 +03:00
<li>
<Link href="/">главная</Link>
</li>
{pathSegments.map((segment, index) => {
const href = '/' + pathSegments.slice(0, index + 1).join('/');
return (
<li key={href}>
<Link href={href}><span className="mx-[2px]">/</span>{correctName[decodeURIComponent(segment) as keyof typeof correctName]}</Link>
</li>
);
})}
</ol>
</nav>
)
}
export default Breadcrumbs;