@@ -5,7 +5,7 @@ import type {SxProp} from '../sx'
5
5
import type { ComponentProps } from '../utils/types'
6
6
import classes from './Breadcrumbs.module.css'
7
7
import type { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic'
8
- import { toggleSxComponent } from '../internal/utils/toggleSxComponent '
8
+ import { BoxWithFallback } from '../internal/components/BoxWithFallback '
9
9
10
10
const SELECTED_CLASS = 'selected'
11
11
@@ -19,13 +19,12 @@ const BreadcrumbsList = ({children}: React.PropsWithChildren) => {
19
19
return < ol className = { classes . BreadcrumbsList } > { children } </ ol >
20
20
}
21
21
22
- const BreadcrumbsBaseComponent = toggleSxComponent ( 'nav' ) as React . ComponentType < BreadcrumbsProps >
23
22
function Breadcrumbs ( { className, children, sx : sxProp } : BreadcrumbsProps ) {
24
23
const wrappedChildren = React . Children . map ( children , child => < li className = { classes . ItemWrapper } > { child } </ li > )
25
24
return (
26
- < BreadcrumbsBaseComponent className = { clsx ( className , classes . BreadcrumbsBase ) } aria-label = "Breadcrumbs" sx = { sxProp } >
25
+ < BoxWithFallback as = "nav" className = { clsx ( className , classes . BreadcrumbsBase ) } aria-label = "Breadcrumbs" sx = { sxProp } >
27
26
< BreadcrumbsList > { wrappedChildren } </ BreadcrumbsList >
28
- </ BreadcrumbsBaseComponent >
27
+ </ BoxWithFallback >
29
28
)
30
29
}
31
30
@@ -37,10 +36,10 @@ type StyledBreadcrumbsItemProps = {
37
36
React . HTMLAttributes < HTMLAnchorElement > &
38
37
React . ComponentPropsWithRef < 'a' >
39
38
40
- const BreadcrumbsItemBaseComponent = toggleSxComponent ( 'a' ) as React . ComponentType < StyledBreadcrumbsItemProps >
41
39
const BreadcrumbsItem = React . forwardRef ( ( { selected, className, ...rest } , ref ) => {
42
40
return (
43
- < BreadcrumbsItemBaseComponent
41
+ < BoxWithFallback
42
+ as = "a"
44
43
className = { clsx ( className , classes . Item , {
45
44
[ SELECTED_CLASS ] : selected ,
46
45
[ classes . ItemSelected ] : selected ,
0 commit comments