diff --git a/static/app/components/breadcrumbs.stories.tsx b/static/app/components/breadcrumbs.stories.tsx new file mode 100644 index 00000000000000..f883c93c2ac0f3 --- /dev/null +++ b/static/app/components/breadcrumbs.stories.tsx @@ -0,0 +1,139 @@ +import {Fragment} from 'react'; + +import {Breadcrumbs} from 'sentry/components/breadcrumbs'; +import * as Storybook from 'sentry/stories'; + +export default Storybook.story('Breadcrumbs', story => { + story('Basics', () => ( + +

+ displays a navigation path with clickable + links. By default, the last item is not clickable to avoid linking to the current + page. +

+ + + +
+ )); + + story('With Last Item Linked', () => ( + +

+ Set to make the last + breadcrumb clickable. +

+ + + +
+ )); + + story('With Dropdown', () => ( + +

+ Breadcrumbs can include dropdown menus for selecting between multiple options. +

+ + { + // eslint-disable-next-line no-console + console.log('Selected:', item); + }, + }, + {label: 'Settings', to: null}, + ]} + /> + +
+ )); + + story('Page Filter Preservation', () => ( + +

+ Use on individual + crumbs to maintain project/environment/time filters when navigating. +

+ + + +
+ )); + + story('Different Lengths', () => ( + +

Examples of breadcrumb trails with different lengths.

+ + {[ + [{label: 'Single Item', to: null}], + [ + {label: 'Home', to: '/'}, + {label: 'Current Page', to: null}, + ], + [ + {label: 'Organization', to: '/org/'}, + {label: 'Project', to: '/project/'}, + {label: 'Issues', to: '/issues/'}, + {label: 'Issue #123', to: null}, + ], + [ + { + label: 'longlonglonglonglonglonglonglonglonglonglonglonglonglonglong', + to: '/org/', + }, + {label: 'Very Long Project Name Here', to: '/project/'}, + {label: 'Settings', to: '/settings/'}, + {label: 'Performance', to: '/performance/'}, + {label: 'Detailed Configuration Page', to: null}, + ], + ].map((crumbs, index) => ( + +

+ {crumbs.length} item{crumbs.length === 1 ? '' : 's'} +

+ + + +
+ ))} +
+
+ )); +}); diff --git a/static/app/components/breadcrumbs.tsx b/static/app/components/breadcrumbs.tsx index 5411151d598db3..20eda4fe5de3cd 100644 --- a/static/app/components/breadcrumbs.tsx +++ b/static/app/components/breadcrumbs.tsx @@ -159,6 +159,7 @@ const BreadcrumbLink = styled( ) )` ${getBreadcrumbListItemStyles} + max-width: 400px; &:hover, &:active {