Fix(Breadcrumbs): Optional action/href in the last breadcrumb
lu-perfect opened this issue · comments
Action and href are not used in the last bit, so specifying action: () => {} is very strange
For example (or just make it optional):
type BreadcrumbItem = {
text: string
href: string
}
type LastBreadcrumbItemOptionalHref = {
text: string
href?: string
}
type BreadcrumbItems =
| BreadcrumbItem[]
| [...BreadcrumbItem[], LastBreadcrumbItemOptionalHref]
const invalidItems: BreadcrumbItems = [
{ text: "Home" },
{ text: "Contacts", href: "/contacts" },
]
const validItems0: BreadcrumbItems = [{ text: "Home" }]
const validItems1: BreadcrumbItems = [
{ text: "Home", href: "/" },
{ text: "Contacts" },
]
const validItems2: BreadcrumbItems = [
{ text: "Home", href: "/" },
{ text: "Contacts", href: "/contacts" },
{ text: "Foo", href: "/contacts/foo" },
{ text: "Emails", href: "/contacts/foo/emails" },
{ text: "Some Email" },
]
@lu-perfect We're planning to replace current Breadcrumbs
with the new one in the next major. The new component doesn't have this issue.