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