Breadcrumb.tsx 622 B

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react';
  2. import { NavLink } from 'react-router-dom';
  3. interface Link {
  4. label: string;
  5. href: string;
  6. }
  7. interface Props {
  8. links?: Link[];
  9. }
  10. const Breadcrumb: React.FC<Props> = ({
  11. links,
  12. children,
  13. }) => {
  14. return (
  15. <nav className="breadcrumb" aria-label="breadcrumbs">
  16. <ul>
  17. {links && links.map(({ label, href }) => (
  18. <li key={label}>
  19. <NavLink to={href}>{label}</NavLink>
  20. </li>
  21. ))}
  22. <li className="is-active">
  23. <span className="">{children}</span>
  24. </li>
  25. </ul>
  26. </nav>
  27. );
  28. }
  29. export default Breadcrumb;