Breadcrumbs Upgrade: Added List system #1765
RayRedGoose
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview of made changes
Breadcrumbs component has been promoted to
canvas-kit-react
package because now it uses the same list system being developed for Tabs, ActionBar which provides the new overflow behavior based on utilizinguseBreadcrumbsModel
. Overflow is dynamic and calculated on the container width.To archive this goal some Breadcrumbs API has been reviewed and the next changes have been made:
Breadcrumbs
has been promoted and now it lives in main react packageBreadcrumbs.Nav
has been removed and replaced byBreadcrumbs
Breadcrumbs.Nav
prop ofaria-label
has been removed toBreadcrumbs
Breadcrumbs.CollapsibleList
has been renamed toBreadcrumbs.List
Breadcrumbs.ListItem
has been renamed toBreadcrumbs.Item
🤖 All the above changes can be handled by running codemod
🙎♂️ The next changes will require manual changes:
Handling Redirects
onAction
has been removed fromBreadcrumbs.Item
, so the way of redirection has been changed.Breadcrumbs.Link
defaults to redirecting with anhref
, which means the page will hard-redirect when the link is clicked. However, if you're in a single-page application (SPA) environment, you might want to use the internal SPA router instead. You can override that behavior with a customonClick
handler that blocks the default behavior of the event and passes along the link path to your SPA router. Most of our consumers usereact-router-dom
for managing SPA routing, so below is an example of how to do this in V5 and V6 ofreact-router-dom
. Read more about moving from Router DOM v5 to v6Overflow behavior
As
Breadcrumbs.CollapsibleList
has been removed, all overflow functionality provided by this component has been removed too. Now overflow functionality is provided by List system and requires to switch toBreadcrumbsModel
manually. In the end of this discussion you can find step-by-step instruction to switch to a new structure.Manual transition to a new structure:
Step-by-step instruction:
Breadcrumbs.ListItem
, all objects inside array should contains anid
property with the uniquestring
value:items
array intoBreadcrumbs
component throughitems
prop:or pass the created model with items:
Rename
Breadcrumbs.Nav
toBreadcrumbs
andBreadcrumbs.CollapsibleList
toBreadcrumbs.List
or if check it's renamed if you used codemod before it.Remove all content inside
Breadcrumbs.List
and add function recreating all items from youritems
array (this structure is similar to.map()
array prototype method callback fn):Breadcrumbs.List
but insideBreadcrumbs
add overflow menu component:Beta Was this translation helpful? Give feedback.
All reactions