fix(docs): add missing Breadcrumbs component props to Props tab#6850
fix(docs): add missing Breadcrumbs component props to Props tab#6850Mugunth007 wants to merge 1 commit intoaws-amplify:mainfrom
Conversation
Fixes aws-amplify#4497 The Breadcrumbs component's Props tab was empty because the interface name BaseBreadcrumbProps (singular) did not match the component name Breadcrumbs (plural). The isPropMainCategory function in the docs generation script uses category.includes(componentName) to filter props into the Main table, so 'breadcrumb' != 'breadcrumbs' caused all Breadcrumbs-specific props to be silently dropped. Changes: - Rename BaseBreadcrumbProps to BaseBreadcrumbsProps to match 'Breadcrumbs' - Remove misleading @deprecated annotation from the interface - Add JSDoc description for the items prop - Add Breadcrumbs.Container to componentsWithChildren - Register Breadcrumbs.Container and BaseBreadcrumbsProps in catalog types
|
bobbor
left a comment
There was a problem hiding this comment.
nice catch. thanks for the fix. LGTM
|
hey @Mugunth007 I have ran the tests and the docs e2e is failing. So you would need to update the snapshot. |
Description
Fixes #4497
The Breadcrumbs component's Props tab on the documentation site was empty because the interface name
BaseBreadcrumbProps(singular) did not match the component nameBreadcrumbs(plural).Root Cause
The
isPropMainCategoryfunction indocs/scripts/generate-props-tables-data.tsuses:s const isCurrentComponentProp = category.toLowerCase().includes(componentName.toLowerCase());Since
'basebreadcrumbprops'does not include'breadcrumbs', the Breadcrumbs-specific props (items,separator) were filtered out of the Main props table.Changes
BaseBreadcrumbPropsBaseBreadcrumbsPropsto match the component nameBreadcrumbs@deprecated For internal use onlyJSDoc annotation@descriptionfor theitemspropBreadcrumbs.ContainertocomponentsWithChildrenBreadcrumbs.ContainerinComponentNametype andBaseBreadcrumbsPropsinCategorytype incatalog.d.tsFiles Changed
packages/react/src/primitives/types/breadcrumbs.ts— Core type rename + JSDocpackages/react/src/primitives/Breadcrumbs/Breadcrumbs.tsx— Updated import/type referencedocs/scripts/util/componentsWithChildren.ts— Added Container sub-componentdocs/scripts/types/catalog.d.ts— Registered new type entriesTesting
After running
yarn build:props-tablesin thedocs/directory, the Props tab should now display:items,separatorpropsisCurrentprop