diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b2ad1..4154ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.5] - 2026-08-12 + +### Changed + +- **Breaking:** `Breadcrumb` now renders links with react-router `Link` directly. Dropped injectable `linkComponent`, `href`, and `linkProps` — use `to` on trail items only. Default link/current/separator colors use slate tones. + +### Removed + +- `BreadcrumbLinkComponent` export (no longer needed). + ## [0.4.4] - 2026-08-12 ### Fixed diff --git a/src/components/components/Breadcrumb/Breadcrumb.tsx b/src/components/components/Breadcrumb/Breadcrumb.tsx index b294d2b..a3d2561 100644 --- a/src/components/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/components/Breadcrumb/Breadcrumb.tsx @@ -1,30 +1,12 @@ -import { - type ComponentType, - type FC, - type ReactNode, -} from 'react' +import { type FC, type ReactNode } from 'react' +import { Link } from 'react-router-dom' export interface BreadcrumbItem { label: ReactNode - /** Used by default `` and as fallback for router links. */ - href?: string - /** Preferred when injecting react-router `Link`. */ + /** Omit on the current page (last item). */ to?: string - /** Extra props passed to the injected link component. */ - linkProps?: Record } -/** - * Injectable link surface for SPA routers. - * `to` is always provided when Breadcrumb renders a link, so react-router `Link` is assignable. - */ -export type BreadcrumbLinkComponent = ComponentType<{ - to: string - href?: string - className?: string - children?: ReactNode -}> - export interface BreadcrumbProps { items: BreadcrumbItem[] /** Defaults to `"/"`. */ @@ -33,35 +15,21 @@ export interface BreadcrumbProps { linkClassName?: string currentClassName?: string separatorClassName?: string - /** Host injects `Link` from react-router (or any anchor-like component). Defaults to ``. */ - linkComponent?: BreadcrumbLinkComponent /** Accessible name for the nav landmark. Defaults to `"Breadcrumb"`. */ label?: string } -const DefaultLink: BreadcrumbLinkComponent = ({ - href, - to, - children, - ...rest -}) => ( - - {children} - -) - /** - * Presentational page trail. Use links/`span` only — never headings. - * Keep a single page `h1` on `FormHeader` or the page title. + * Page trail (`nav` + `ol`). Links use react-router `Link`. + * Never uses headings — keep a single page `h1` on `FormHeader` or the page title. */ const Breadcrumb: FC = ({ items, separator = '/', className = '', - linkClassName = 'text-sky-700 hover:text-sky-900 hover:underline', - currentClassName = 'text-gray-700', - separatorClassName = 'text-gray-400', - linkComponent: LinkComponent = DefaultLink, + linkClassName = 'text-slate-500 hover:text-slate-800 hover:underline', + currentClassName = 'text-slate-700', + separatorClassName = 'text-slate-400', label = 'Breadcrumb', }) => { if (items.length === 0) @@ -75,8 +43,7 @@ const Breadcrumb: FC = ({
    {items.map((item, index) => { const isLast = index === items.length - 1 - const target = item.to ?? item.href - const isLink = !isLast && Boolean(target) + const isLink = !isLast && Boolean(item.to) return (
  1. = ({ ) : null} - {isLink && target ? ( - {item.label} - + ) : ( (
    -
    - -
    + Edit shop item
    Form content