Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
czearing committed Oct 16, 2020
1 parent 3af4d91 commit d63fd49
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/react-tabs/src/components/Pivot/Pivot.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ export const PivotBase: React.FunctionComponent<IPivotProps> = React.forwardRef<
const [selectedKey, setSelectedKey] = useControllableValue(props.selectedKey, props.defaultSelectedKey);

const { componentRef, theme, linkSize, linkFormat, overflowBehavior } = props;
// The overflow menu starts empty and items[] is updated as the overflow items change
const overflowMenuProps: IContextualMenuProps = {
items: [],
doNotLayer: true,
alignTargetEdge: true,
directionalHint: DirectionalHint.bottomRightEdge,
};

let classNames: { [key in keyof IPivotStyles]: string };
const divProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, divProperties);
Expand Down Expand Up @@ -227,6 +220,17 @@ export const PivotBase: React.FunctionComponent<IPivotProps> = React.forwardRef<
renderPivotLink(linkCollection, l, renderedSelectedKey, classNames.link),
);

// The overflow menu starts empty and items[] is updated as the overflow items change
const overflowMenuProps: IContextualMenuProps = React.useMemo(
() => ({
items: [],
doNotLayer: true,
alignTargetEdge: true,
directionalHint: DirectionalHint.bottomRightEdge,
}),
[],
);

const { menuButtonRef: overflowMenuButtonRef } = useOverflow({
onOverflowItemsChanged: (overflowIndex, elements) => {
// Set data-is-overflowing on each item
Expand All @@ -253,7 +257,7 @@ export const PivotBase: React.FunctionComponent<IPivotProps> = React.forwardRef<
{items}
{overflowBehavior === 'menu' && (
<CommandButton
className={classNames.link + ' ' + classNames.overflowMenuButton}
className={css(classNames.link, classNames.overflowMenuButton)}
elementRef={overflowMenuButtonRef}
componentRef={overflowMenuButtonComponentRef}
menuProps={overflowMenuProps}
Expand Down

0 comments on commit d63fd49

Please sign in to comment.