diff --git a/packages/react-components/react-breadcrumb-preview/stories/Breadcrumb/BreadcrumbWithOverflow.stories.tsx b/packages/react-components/react-breadcrumb-preview/stories/Breadcrumb/BreadcrumbWithOverflow.stories.tsx index 0e57d364aa526..07c9f14cf9b84 100644 --- a/packages/react-components/react-breadcrumb-preview/stories/Breadcrumb/BreadcrumbWithOverflow.stories.tsx +++ b/packages/react-components/react-breadcrumb-preview/stories/Breadcrumb/BreadcrumbWithOverflow.stories.tsx @@ -13,7 +13,7 @@ import { useOverflowMenu, Overflow, OverflowItem, - MenuItem, + MenuItemLink, OverflowDivider, } from '@fluentui/react-components'; import { @@ -35,69 +35,78 @@ import type { PartitionBreadcrumbItems } from '@fluentui/react-breadcrumb-previe const CalendarMonth = bundleIcon(CalendarMonthFilled, CalendarMonthRegular); const MoreHorizontal = bundleIcon(MoreHorizontalFilled, MoreHorizontalRegular); -type ButtonItem = { +type Item = { key: number; item?: string; - buttonProps?: { + itemProps?: { icon?: ButtonProps['icon']; disabled?: boolean; + href?: string; }; }; -const buttonItems: ButtonItem[] = [ +const items: Item[] = [ { key: 0, item: 'Item 0', + itemProps: { + href: 'https://react.fluentui.dev/', + }, }, { key: 1, item: 'Item 1', - buttonProps: { + itemProps: { icon: , + href: 'https://react.fluentui.dev/', }, }, { key: 2, item: 'Item 2', + itemProps: { + href: 'https://react.fluentui.dev/', + }, }, { key: 3, item: 'Item 3', + itemProps: { + href: 'https://react.fluentui.dev/', + }, }, { key: 4, item: 'Item 4', + itemProps: { + href: 'https://react.fluentui.dev/', + }, }, { key: 5, item: 'Item 5', - buttonProps: { + itemProps: { icon: , disabled: true, + href: 'https://react.fluentui.dev/', }, }, { key: 6, item: 'Item 6', - buttonProps: { - disabled: true, + itemProps: { + href: 'https://react.fluentui.dev/', }, }, { key: 7, item: 'Item 7', + itemProps: { + href: 'https://react.fluentui.dev/', + }, }, ]; -const useOverflowMenuStyles = makeStyles({ - menu: { - backgroundColor: tokens.colorNeutralBackground1, - }, - menuButton: { - alignSelf: 'center', - }, -}); - const useExampleStyles = makeStyles({ example: { backgroundColor: tokens.colorNeutralBackground2, @@ -105,33 +114,26 @@ const useExampleStyles = makeStyles({ ...shorthands.padding('5px'), zIndex: 0, //stop the browser resize handle from piercing the overflow menu height: 'fit-content', - minWidth: '150px', + minWidth: '200px', resize: 'horizontal', width: '600px', }, }); -const useStyles = makeStyles({ - root: { - alignItems: 'flex-start', - display: 'flex', - flexDirection: 'column', - justifyContent: 'flex-start', - ...shorthands.overflow('auto'), - ...shorthands.padding('50px', '20px'), - rowGap: '20px', - }, -}); - -const OverflowBreadcrumbButton: React.FC<{ id: string; item: ButtonItem }> = props => { +const MenuItem: React.FC<{ id: string; item: Item }> = props => { const { item, id } = props; const isVisible = useIsOverflowItemVisible(id); + const href = item.itemProps?.href || ''; if (isVisible) { return null; } - return {item.item}; + return ( + + {item.item} + + ); }; const OverflowGroupDivider: React.FC<{ @@ -144,12 +146,12 @@ const OverflowGroupDivider: React.FC<{ ); }; -const renderButton = (el: ButtonItem, isLastItem: boolean = false) => { +const renderBreadcrumbItem = (el: Item, isLastItem: boolean = false) => { return ( - + {el.item} @@ -159,12 +161,10 @@ const renderButton = (el: ButtonItem, isLastItem: boolean = false) => { ); }; -const ControlledOverflowMenu = (props: PartitionBreadcrumbItems) => { +const OverflowMenu = (props: PartitionBreadcrumbItems) => { const { overflowItems, startDisplayedItems, endDisplayedItems } = props; const { ref, isOverflowing, overflowCount } = useOverflowMenu(); - const styles = useOverflowMenuStyles(); - if (!isOverflowing && overflowItems && overflowItems.length === 0) { return null; } @@ -175,40 +175,33 @@ const ControlledOverflowMenu = (props: PartitionBreadcrumbItems) =>