File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/components/Breadcrumbs Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ export const Breadcrumbs = React.forwardRef(function Breadcrumbs(
6262 typeof props . maxItems === 'number' && props . maxItems < items . length
6363 ? props . maxItems - 1
6464 : undefined ,
65+ getChildWidth : ( child ) => {
66+ const width = child . getBoundingClientRect ( ) . width ;
67+ const maxWidth = child . dataset . current ? 200 : Infinity ;
68+ return Math . min ( maxWidth , width ) ;
69+ } ,
6570 } ) ;
6671
6772 useResizeObserver ( {
@@ -155,6 +160,7 @@ export const Breadcrumbs = React.forwardRef(function Breadcrumbs(
155160 ref = { isMenu ? menuRef : undefined }
156161 key = { isMenu ? 'menu' : `item-${ key } ` }
157162 className = { b ( 'item' , { calculating : isCurrent && ! calculated , current : isCurrent } ) }
163+ data-current = { isCurrent ? isCurrent : undefined }
158164 >
159165 { item }
160166 { isCurrent ? null : < BreadcrumbsSeparator separator = { props . separator } /> }
You can’t perform that action at this time.
0 commit comments