BreadcrumbsView.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { Fragment } from 'react'
  2. interface BreadcrumbsViewProps {
  3. defaultValue: any
  4. }
  5. export const BreadcrumbsView = ({ defaultValue: breadcrumbs }: BreadcrumbsViewProps) => {
  6. return (
  7. <>
  8. {breadcrumbs?.length
  9. ? breadcrumbs.map((breadcrumb: any, i: number) => (
  10. <Fragment key={breadcrumb.key}>
  11. {i > 0 && (
  12. <span className="text-border-stronger dark:text-border-strong">
  13. <svg
  14. viewBox="0 0 24 24"
  15. width="16"
  16. height="16"
  17. stroke="currentColor"
  18. strokeWidth="1"
  19. strokeLinecap="round"
  20. strokeLinejoin="round"
  21. fill="none"
  22. shapeRendering="geometricPrecision"
  23. >
  24. <path d="M16 3.549L7.12 20.600"></path>
  25. </svg>
  26. </span>
  27. )}
  28. <a
  29. onClick={breadcrumb.onClick || (() => {})}
  30. className={`text-gray-1100 block px-2 py-1 text-xs leading-5 focus:bg-gray-100 focus:text-gray-900 focus:outline-hidden ${
  31. breadcrumb.onClick ? 'cursor-pointer hover:text-white' : ''
  32. }`}
  33. >
  34. {breadcrumb.label}
  35. </a>
  36. </Fragment>
  37. ))
  38. : null}
  39. </>
  40. )
  41. }