Skip to content

Commit a442020

Browse files
committed
breadcrumbs: fix overflowing
1 parent a46d84c commit a442020

File tree

4 files changed

+31
-110
lines changed

4 files changed

+31
-110
lines changed

static/app/components/breadcrumbs.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export default Storybook.story('Breadcrumbs', story => {
7272
],
7373
[
7474
{
75-
label: 'longlonglonglonglonglonglonglonglonglonglonglonglonglonglong',
75+
label:
76+
'A Very Long Project Name Here That Will Be Truncated Because It Is Too Long',
7677
to: '/org/',
7778
},
7879
{label: 'Very Long Project Name Here', to: '/project/'},

static/app/components/breadcrumbs.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Fragment} from 'react';
22

3-
import {Flex} from '@sentry/scraps/layout';
3+
import {Container, Flex} from '@sentry/scraps/layout';
44
import {Text} from '@sentry/scraps/text';
55

66
import type {LinkProps} from 'sentry/components/core/link';
@@ -46,6 +46,7 @@ export function Breadcrumbs({crumbs, ...props}: BreadcrumbsProps) {
4646

4747
return (
4848
<Flex
49+
as="nav"
4950
gap="xs"
5051
align="center"
5152
padding="md 0"
@@ -60,7 +61,9 @@ export function Breadcrumbs({crumbs, ...props}: BreadcrumbsProps) {
6061
variant={index === crumbs.length - 1 ? 'primary' : 'muted'}
6162
/>
6263
{index < crumbs.length - 1 ? (
63-
<IconChevron size="xs" direction="right" color="subText" />
64+
<Flex align="center" justify="center" flexShrink={0}>
65+
<IconChevron size="xs" direction="right" color="subText" />
66+
</Flex>
6467
) : null}
6568
</Fragment>
6669
);
@@ -81,20 +84,29 @@ function BreadCrumbItem(props: BreadCrumbItemProps) {
8184
}
8285
}
8386

84-
if (props.crumb.to) {
85-
return (
86-
<BreadcrumbLink
87-
to={props.crumb.to}
88-
preservePageFilters={props.crumb.preservePageFilters}
89-
data-test-id="breadcrumb-link"
90-
onClick={onBreadcrumbLinkClick}
91-
>
92-
<Text variant={props.variant}>{props.crumb.label}</Text>
93-
</BreadcrumbLink>
94-
);
95-
}
96-
97-
return <Text variant={props.variant}>{props.crumb.label}</Text>;
87+
return (
88+
<Container maxWidth="400px" width="auto">
89+
{styleProps => {
90+
return props.crumb.to ? (
91+
<BreadcrumbLink
92+
to={props.crumb.to}
93+
preservePageFilters={props.crumb.preservePageFilters}
94+
data-test-id="breadcrumb-link"
95+
onClick={onBreadcrumbLinkClick}
96+
{...styleProps}
97+
>
98+
<Text ellipsis variant={props.variant}>
99+
{props.crumb.label}
100+
</Text>
101+
</BreadcrumbLink>
102+
) : (
103+
<Text ellipsis variant={props.variant} {...styleProps}>
104+
{props.crumb.label}
105+
</Text>
106+
);
107+
}}
108+
</Container>
109+
);
98110
}
99111

100112
interface BreadcrumbLinkProps extends LinkProps {

static/app/components/chevron.tsx

Lines changed: 0 additions & 90 deletions
This file was deleted.

static/app/utils/analytics/breadcrumbsAnalyticsEvents.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ export type BreadcrumbsAnalyticsEventParameters = {
33
'breadcrumbs.menu.clicked': {organization: null};
44
};
55

6-
export type BreadcrumbsAnalyticsKey = keyof BreadcrumbsAnalyticsEventParameters;
7-
86
export const breadcrumbsAnalyticsEventMap: Record<
9-
BreadcrumbsAnalyticsKey,
7+
keyof BreadcrumbsAnalyticsEventParameters,
108
string | null
119
> = {
1210
'breadcrumbs.link.clicked': 'Breadcrumbs: Link Clicked',

0 commit comments

Comments
 (0)