Skip to content

Commit

Permalink
fix: Updated Breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-bagwell committed Nov 5, 2024
1 parent bdb92c4 commit a78d542
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cypress/component/Breadcrumbs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ context(
'given the [Components/Navigation/Breadcrumbs, Overflow Breadcrumbs] menu is rendered',
() => {
beforeEach(() => {
cy.mount(<OverflowBreadcrumbs width={'480px'} />);
cy.mount(<OverflowBreadcrumbs width="480px" />);

openDropdownMenu();
});
Expand Down
1 change: 1 addition & 0 deletions modules/react/breadcrumbs/stories/Breadcrumbs.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const Basic: Story = {
render: BasicExample,
};
export const OverflowBreadcrumbs: Story = {
// @ts-ignore Storybook doesn't allow the use of props within components
render: OverflowBreadcrumbsExample,
};
export const RTLOverflowList: Story = {
Expand Down
15 changes: 9 additions & 6 deletions modules/react/breadcrumbs/stories/examples/Overflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const OverflowBreadcrumbs = ({width = '100%'}) => {

const model = useBreadcrumbsModel({items});
const [containerWidth, setContainerWidth] = React.useState(width);

console.log('width', width);
return (
<div>
<Box width={containerWidth} marginBottom="xl">
Expand All @@ -32,10 +32,7 @@ export const OverflowBreadcrumbs = ({width = '100%'}) => {
</div>
<hr />
<Breadcrumbs model={model} aria-label="Breadcrumbs">
<Breadcrumbs.List
width={width}
overflowButton={<Breadcrumbs.OverflowButton aria-label="More links" />}
>
<Breadcrumbs.List overflowButton={<Breadcrumbs.OverflowButton aria-label="More links" />}>
{item =>
item.link ? (
<Breadcrumbs.Item>
Expand All @@ -59,7 +56,13 @@ export const OverflowBreadcrumbs = ({width = '100%'}) => {
</Box>
<hr />
<h4>Change Breadcrumbs container size</h4>
<SegmentedControl onSelect={data => setContainerWidth(data.id)}>
<SegmentedControl
initialValue={width}
onSelect={data => {
console.log('you called?');
setContainerWidth(data.id);
}}
>
<SegmentedControl.List aria-label="container width control" marginBottom="m">
<SegmentedControl.Item data-id="100%">100%</SegmentedControl.Item>
<SegmentedControl.Item data-id="480px">480px</SegmentedControl.Item>
Expand Down

0 comments on commit a78d542

Please sign in to comment.